We currently use Eclipse for Android development , and our projects are synchronized to an SVN .
Current structure :
It is therefore independent projects on SVN.
Details :
Android Android app 1 need library 1 Android Android app 2 need library 1 and 2 , etc ...
Until then, it is quite normal.
The challenge is to move to the project structure in Android Studio / IntelliJ , while ensuring compatibility with eclipse . So changing NOTHING in the current structure of SVN .
And I just can't handle how to do this with the IntelliJ structure (projects, modules, ... ) .
In addition there appears to have a problem with Android Studio, it is impossible for me to IMPORT module , I can create one, but not import one...
And that's not all , in "Open Module settings" , only Android SDK Appears for EACH project. So I can not handle modules ...
I tried to import each project one by one with a checkout from Subversion, it works, but how to link projects to each other then ? I end up with a project structure as in eclipse, and I guess that is not good.
In Android Studio, a module is dependent on a project (right ?), but I do not want a library dependent of any project.
Please, do not hesitate to ask any information. I'm sure that I didn't say everything, because I try that from 2 days now, so I've try many many things... I just can't get it.
What's wrong ?
Thanks a lot
Best Regards
Start Android Studio and open the project you'd like to add the module to. From the Android Studio menu click File > New > Import Module. Select the Eclipse ADT project folder with the AndroidManifest. xml file and click Ok.
Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.
Firstly you should generate a gradle build file for each of your projects. You can do this in Eclipse. Go to File > Export > Android Gradle Files.
At the end you should have this architecture on you project :
root
build.gradle
settings.gradle
AndroidProj1
build.gralde
AndroidProj2
build.gradle
AndroidLib1
build.gralde
AndroidLib2
build.gradle
Make sure that all your projects are refereced in your settings.gradle. You should have these lines:
:AndroidProj1
:AndroidProj2
:AndroidLib1
:AndoridLib2
Then, in build.gradle files of your projects, you can make references of other projects. If AndroidProj1 depends on AndroidLib1, then you should have these lines in build.gradle of AndroidProj1:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':AndroidLib1')
}
When Eclipse generate gradle files, it keeps the old directory structure so you can keep using Eclipse.
In Android Studio, you should import only the root project. It will find the underlying projects.
Then you can try to build your projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With