I have an Android project recently converted to Gradle from Maven/IntelliJ. The project has a traditional maven structure with the app and sdk projects being sibling projects referenced through the nexus. I can import either of the projects into Android Studio correct and build them, but when I try to import the SK as a module into the app project (which is what we did in IntelliJ) Android Studio basically refuses to import it. I'm using Android Studio 0.8.2. The actual error I get is either
Specify location of the Gradle or Android Eclipse project
if I select the SDK's .iml file or
Select modules to import
if I select the build.gradle file or the root directory.
I would like to avoid converting to the current Gradle super project mechanism because that would require new source control and would lose valuable history.
What I have tried:
Separate projects, works but doesn't allow SDK debugging and generally is a pain to manage due the multiple windows.
Using an empty super project. This gets both projects in the same windows, but Android Studio no longer detects the project's source controls. IntelliJ would correctly identify the sibling source controls in the previous configuration.
Is there any way to get Module Import to work in Android Studio like in IntelliJ?
Related
I'm trying to open the DeskClockApp (https://android.googlesource.com/platform/packages/apps/DeskClock/) in my version of Android Studio. However, since no gradle files are downloaded, Android Studio is struggling to see the project as an Android-Gradle app.
I've tried downloading the source code as a zip, importing it as Git from Android Studio's VCS, etc. The online repository doesn't have the gradle files b/c the developer added a gitignore for gradle (makes sense). I also considered adding the gradle files myself but the project structure seems to be slightly different than the structure defined online. When I first import that project it says Android Framework detected, however, on configuring it for Android it cannot find any module to run, or even display the correct files (in the Project view). Is there any way to generate the correct gradle files for this? Maybe run it without gradle?
Currently, I'm trying to work with a git server hosted at my company. When I'm initiating the git inside my Android projet root directory, there's some files automaticaly ignored, why ?
Next, when I clone my project in another computer (with a different OS and a different SDK installation path) and when I try to import the cloned project, Android Studio seems to not find a proper existing project : I see the gradle icon instead of the Android Studio icon :
Project import screenshot
How can I make a proper import ?
Thanks for your answers.
IDE project files are meant to be ignored. These files usually contain local configuration files, like paths and configuration to run and build software depending on your machine/OS.
Importing a gradle project should result in a new Android Studio / IntelliJ project. About the files that are ignored, those should be the local build files that I mentioned.
Do you experience issues when you are just importing the project?
I made some apps in the past with android studio, and there was no problems with them.
And I could open example projects from many sites, for example: developer.android.com/.
Now after an update of android studio, I can't open projects in android studio without migrating them manually, which was done before the update by android studio itself.
What could be the problem now?
First I get this warning, that android framework is detected.
Then after choosing the setup frameworks and clicking ok, I get this:
As you can see it is not gradle based project.
What can I do to make android studio automatically migrate projects again?
IMPORTING ANDROID STUDIO PROJECT IN ANDROID STUDIO:
If you want to import An Android Studio Project then do the following:
1.
Select Open an existing Android Studio Project
2. Browse your desired project derectory.
3. Now rather than selecting the folder that contains your project, you have to select the build.gradle file that is just inside of your parent folder of the project.
It will not create any problem and will not ask you to migrate into gradle and import any framework at all.
IMPORTING ECLIPSE PROJECT IN ANDROID STUDIO:
If you want to import Eclipse Project in Android Studio:
1. Select Import project (Eclipse ADT, Gradle, etc.)
2. Then nothing special just follow the instructions in the wizard.
How can you migrate to Android Studio using an Eclipse project depending one many user libraries?
I've tried using the Eclipse export to gradle but I can't seem to get it to work.
Also, my project sources are not in the workspace.
As of Android Studio 0.4.2, you can now import the Eclipse project from Android Studio.
Note: This is different from Eclipse's export Gradle project function.
Open Android Studio
Verify the version is >0.4.2, if not update to it. (I had to download it from the tools website)
Import Project...
Navigate to the actual Android app project, the highest level project (not the workspace or the directory containing all the eclipse projects)
Follow the wizard to import it all
The advantages of doing it this was is that :
makes the migration less painful
generates gradle files
restructures your project as a gradle/Android Studio project
The team is using Android Studio to develop Android projects. But researching Unit Tests, it looks like the support for JUnit Test Cases is in Eclipse. After exporting a test project from Eclipse and importing it into Android Studio I was under the mistaken impression that I could go back and forth. But when I added a java class to the project in Android Studio, the new java class does not show up in the Eclipse project.
I could import the new class if I wanted to move it to a different location first. So, is there any way to get the Eclipse project to recognize the file on disk should be included in the project?