I'm developing an android app, in which I recently migrated from Eclipse to Android Studio and Gradle.
In my projected I created 5 UI Libs, and added them as modules in my project, libs I have created are pushed on my github account (publicly).
In eclipse when you add external dependency for a project marked as lib, when you update the external project's code then you clean your build, your project get these updates, but in Gradle I noticed that it creates Physical Copies, completely independent from their sources, my question is how can I change only external libs and have my project updated.
here's a snipped from my gradle's config:
dependencies {
// Libraries
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:5.0.89'
.
.
.
compile 'com.squareup.picasso:picasso:2.4.0'
// Projects
compile project(':com.shehabic.helpicon')
.
.
}
I've read that is not recommended but it is practical for debugging:
File > Project Structure... > PLUS sign to add module
"Create New Module" dialogs:
Back at "Project Structure" dialog:
That does create a copy of your package inside your android project but it also generates all necessary information and files, and you can always get rid of the copy or leave it alone.
Your module have been added to the settings.gradle file:
':app', ':module_name'
A build.gradle file for your module have been created:
configurations.maybeCreate("default")
artifacts.add("default", file('package.jar'))
And the dependency has been added to the build.gradle of your ':app':
compile project(':module_name')
configurations.maybeCreate("default")
artifacts.add("default", file('X:\Java\Applications\YourApplication\dist\package.jar'))
Wherever you edit your package, just "Clean & Build" it. Whenever you want your app to reflect that "update" in the package from outside your android project, just sync. When you are done debugging, you can remove the module, the dependency and the old copy, and add the last build of your package as a copy.
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