I am writing an Android app using IntelliJ IDEA.
My project file is generated as android.iml because my project folder is named android.
The project folder of my partner is named cleverlotto (app name). Because of this IntelliJ generates a second project file named cleverlotto.iml.
Now we are working with different project settings.
So how can we use the same project file without using the same project folder name?
I asked the same question to Jetbrains Support.
Answer:
It is not possible to rename root module without also renaming root
directory of the project.
Related
I'm trying to move my IntelliJ IDEA (2017.3) Android project to another computer just copying the files and it does not work. I am aware of this and this, but in the case of Android project it does not work. All the xml files inside .idea store paths relative to the home ($USER_HOME$) instead of project home ($PROJECT_DIR$). Oddly, Maven projects seem to generate paths relative to the project home and those ones can be copied. But not with gradle projects.
Anyone knows how to solve this ?
EDIT: Bear in mind that I want to copy ALL project settings included running configurations. I want that someone opens the project and find exactly what I have. I know I can reimport the project, but then I'll loose some configuration.
Here's the files and folders that need to be excluded from the copy (assuming that your project has a module called app), preferably if you copy the entire project folder to some where else on the same computer and then deleting the unneeded one by one:
folders .idea, .gradle or any folder who's name starts with a .. They are usually found within the root folder of the project and within the module root folder.
build folder found in the project root folder and in module root folder.
any file who's extension is .iml, found in the project root folder and in module root folder.
local.properties found in project root folder.
The rest of the files and folders need to be kept. With the above excluded, the project can be re-imported in Android Studio properly with the correct configurations relative to your second PC.
On a side note, these are the typical exclusions added in .gitignore of an Android Project Git Repo.
Ok, I found the problem. It is related to how gradle resolve symlinks. This is the issue. Summarizing, if you open your project with a path that contains a symlink, absolute paths will be created in the configuration files and your project won't be portable.
I have reopened the project again using an absolute path and then all the configuration files use PROJECT_DIR instead of USER_HOME
I am following some posts/questions about AndroidStudio-1.2 and it seems that there is a different project structure: app/src/main; while my old 1.0 project looked like: src/main (no app).
Not sure if this is causing this, but I am not able to get gradle to identify any test files, while running tests.
You probably have to rename src/test to src/androidTest.
The app directory is a subproject directory. By default AndroidStudio generate a structure ready for multi-module project. i.e. :
a root directory with the root build.gradle + gradle.settings (listing all modules in your project)
a subdirectory (named "app") where you can put all the sources for your application.
Later it is more easy to add a library module (just create a directory myLib in the root folder).
This structure is just proposed by AndroidStudio: you can also use AndroidStudio with only one level of directory and one single build.gradle.
I found a library on git. https://github.com/flavienlaurent/NotBoringActionBar
after imported to the eclipse, I noticed that the src folder is empty and there is a folder called java. Tried to run it anyway but it gave me an error.
Do I have to make some changes before running it?
The project you are trying to import is developed with Android studio, so there is some extra files in it.
To import it in your eclipse you need to import it as normal android project. now your src folder is empty and you have an extra folder named java
copy com package from java folder and paste it in src folder
Delete java and bin folder
Clean and build your project
Run on emulator or device
The Project you are trying to import is a project based on Gradle build system developed using Android Studio.
In such project everything related to code is in App/src/main
/java contains all .java files
/res same as res in eclipse
AndroidManifest.xml
So easiest solution is create a new project in eclipse and copy paste the file accordingly,
In you case
Copy the src/com directory in /src in eclipse
Copy the /res in to /res directory of created project
Replace AndroidManifest.xml
But it is strongly recommended to migrate from Eclipse to Android Studio instead of doing all these because now all the libraries available are migrating in to gradle.
I develop an SDK, and would like to be able to check in module files for both IntelliJ IDEA and Android Studio. I've devised the following solution, with one missing piece:
Create module files ending in -intellij-idea for the main project, and each module.
Create build.gradle files, and use the "sourceset" directive to use the old style src and res directory structure.
The problem is that the project information is always stored in a directory called ".idea". Before, I could have two IPR files, such as my-project-android-studio.ipr and my-project-intellij-idea.ipr. I could then open one in Android Studio, and the other in Intellij IDEA, but the actual source would remain the same.
How can I accomplish this? If there is a way to force Android Studio to generate IPR files instead of the ridiculous .idea directory, that would be optimal.
I have an Android project(A) that uses one library module(B) in Intellij IDEA 11. In the main module(A) I have a database file into assets directory and it's working fine.
Let's name the project modules like this: Main module (Module A) and secondary module(Module B).
Now I have to create a database for the library module(B) too and I added the database file into B assets directory because I thought that after compiling the project will be formed of one project having merged the module A and B. But the problem is that the B's database is not copied into the project assets directory.
Is there a way to tell Intellij to merge the assets directory too?
PS: I also have different resources in B's res directory and the application is working properly...
Thank you!
I am not familiar with IntelliJ. But I think this is more related to the Android SDK constraints, other than a config setting from IDE. as it is stated in the official dev guide here:
Library projects cannot include raw assets
The tools do not support the use of raw asset files (saved in the assets/ directory) in a library project. Any asset resources used by an application must be stored in the assets/ directory of the application project itself. However, resource files saved in the res/ directory are supported.
You should not use assets folder in library project, instead, put all db files into your main project's assets folder.
IntelliJ IDEA 11.1 already supports copying assets from Maven apklib dependencies and Android library modules in usual projects. http://youtrack.jetbrains.com/issue/IDEA-80771
You can define an artifact for the project settings for that.
To do so: Right click the Module B project then choose "Open Module Settings". Select Artifacts and press + button to define a new one. Choose the "Other" type and for "Output Layout" select "Add copy of File".