When running assembleDebug, the release related tasks of projects I depend on are called.
e.g. I have a project called 'x' which depends on 'y'.
When I gradle assembleDebug
it calls y:mergeReleaseProguardFiles, packageReleaseAidl, etc... etc..
Enable build caching For example, ./gradlew assembleDebug --build-cache . You can also configure build caching on your gradle. properties file. Estimates that this will improve your full clean build by up to 3 times faster, and incremental builds by up to 10 times faster!
will take 10-12 mins after that it will be good to go.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
Edit: Not true anymore, with Android Gradle Plugin 3.x.
The libraries also publish debug
and release
artifacts. If the project has flavors or custom types, those are also created. And across modules, it tries to automatically match variants. If not matched, you need to provide matchingFallback
to match variants across modules. More info can be found here: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#resolve_matching_errors
Android library modules publishes only "release" build type. They don't have "debug" build type. Even your application module build the debug version, it will use the release version of the library.
You can enable "debug" build type of the library dependency using the following in your module's build.gradle
file:
android {
publishNonDefault true
...
}
Then when you are using that dependency in the other module, you should use like this:
dependencies {
releaseCompile project(path: ':moduleY', configuration: 'release')
debugCompile project(path: ':moduleY', configuration: 'debug')
}
I am using the same trick in my application. I have a shared module and I use debug version of the module. Find details here:
https://github.com/pomopomo/WearPomodoro/blob/develop/mobile/build.gradle#L90
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