in Education by
I'm making a new Android project, with the standard 'app' module, as well as a library project (let's call it 'custom_lib'). In the app's build.gradle file, I link the module as such : dependencies { compile project(':custom_lib') } When I trigger the build process (Menu Build > Make Project), I get the following output in the Gradle console Executing tasks: [clean, :app:compileDebugSources, :custom_lib:compileDebugSources] Configuration on demand is an incubating feature. :app:clean :custom_lib:clean :app:preBuild :app:preDebugBuild :app:checkDebugManifest :app:preReleaseBuild :custom_lib:compileLint :custom_lib:copyReleaseLint UP-TO-DATE :custom_lib:mergeReleaseProguardFiles UP-TO-DATE :custom_lib:preBuild :custom_lib:preReleaseBuild :custom_lib:checkReleaseManifest :custom_lib:prepareReleaseDependencies :custom_lib:compileReleaseAidl :custom_lib:compileReleaseRenderscript :custom_lib:generateReleaseBuildConfig :custom_lib:generateReleaseAssets UP-TO-DATE :custom_lib:mergeReleaseAssets :custom_lib:generateReleaseResValues UP-TO-DATE :custom_lib:generateReleaseResources :custom_lib:packageReleaseResources :custom_lib:processReleaseManifest :custom_lib:processReleaseResources :custom_lib:generateReleaseSources :custom_lib:compileReleaseJava :custom_lib:processReleaseJavaRes UP-TO-DATE :custom_lib:packageReleaseJar :custom_lib:compileReleaseNdk :custom_lib:packageReleaseJniLibs UP-TO-DATE :custom_lib:packageReleaseLocalJar UP-TO-DATE :custom_lib:packageReleaseRenderscript UP-TO-DATE :custom_lib:bundleRelease :app:prepareComAndroidSupportAppcompatV72102Library :app:prepareComAndroidSupportSupportV42102Library :app:prepareTestDoubleBuildCustom_libUnspecifiedLibrary :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources :app:mergeDebugResources :app:processDebugManifest :app:processDebugResources :app:generateDebugSources :app:compileDebugJava :app:compileDebugNdk :app:compileDebugSources :custom_lib:preDebugBuild :custom_lib:checkDebugManifest :custom_lib:prepareDebugDependencies :custom_lib:compileDebugAidl :custom_lib:compileDebugRenderscript :custom_lib:generateDebugBuildConfig :custom_lib:generateDebugAssets UP-TO-DATE :custom_lib:mergeDebugAssets :custom_lib:generateDebugResValues UP-TO-DATE :custom_lib:generateDebugResources :custom_lib:packageDebugResources :custom_lib:processDebugManifest :custom_lib:processDebugResources :custom_lib:generateDebugSources :custom_lib:compileDebugJava :custom_lib:compileDebugNdk :custom_lib:compileDebugSources BUILD SUCCESSFUL Total time: 2.184 secs What puzzles me is that the build mechanism triggers a Debug build (as the first line says), but almost immediately, Gradle uses the task :app:preReleaseBuild which make my custom_lib module to be built with the Release configuration. And then, after the app is fully built, Gradle compiles my module with the Debug configuration. So my questions are : Why is it doing this double build which seems incoherent ? How can I make sure that the library is built with debug configuration when I launch a Debug build process ? EDIT : app/build.gradle : apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.1" defaultConfig { applicationId "com.deezer.testdoublebuild" minSdkVersion 8 targetSdkVersion 21 versionCode 1 versionName "1.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } buildTypes { debug{ debuggable true } release { debuggable false minifyEnabled false } } } dependencies { compile project(':custom_lib') } custom_lib/build.gradle : apply plugin: 'com.android.library' android { compileSdkVersion 21 buildToolsVersion "21.1.1" defaultConfig { applicationId "com.deezer.mylibrary" minSdkVersion 8 targetSdkVersion 21 versionCode 1 versionName "1.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { } Note : I'm using Android Studio 1.0 RC 1 / Gradle 2.2, and reproduced this issue by creating a new project from scratch, add an empty Android Library module, and "voila" JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Put this in your app dependencies: dependencies { debugCompile project(path: ':custom_lib', configuration: "debug") releaseCompile project(path: ':custom_lib', configuration: "release") } and in your library's build.gradle add: android { defaultConfig { defaultPublishConfig 'release' publishNonDefault true } } Then the library will be built in the same mode as the app. Contrary to previous revisions of this answer, I've confirmed a flavor is not required on the library (this may be due to Gradle or Android plugin versions - I'm using Gradle 2.14 and Android plugin 2.1.0 and did not require it). Edit: You may have trouble if you don't clean/rebuild after modifying the gradle files, as outlined in this answer here.

Related questions

0 votes
    I have quite a big solution here with a lot of different web applications and sites, around 10-15 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    A gitlab-runner configuration script .gitlab-ci.yml, for execution in the Powershell: windows: tags: - ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    Auto-configuration report can be logged to the console by enabling debug mode while starting the application. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    ______ suspends the execution of a function wherever it is called and puts the function in debug mode. (a) ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    How can I fix this issues while compiling release build in Android Studio 3.0 RC2 Error:Error: commons- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I am able to create and run a simple GWT application by creating all the files myself. It works ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 20, 2022 in Education by JackTerrance
0 votes
    My application crashes whenever my location is changed. Application structure is simple: there is one Activity and ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 8, 2022 in Education by JackTerrance
0 votes
    From an architecture perspective, I'm trying to get a better understand of how and where files deployed to eb (t2) ... ec2(t2) server? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am running aspnet_compiler as a post-build event, using the following command: aspnet_compiler.exe -v / - ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    While I try to answer any question in brainly app, the cursor is moving from right to left instead of moving ... Why does it happen? Select the correct answer from above options...
asked Nov 29, 2021 in Education by JackTerrance
0 votes
    Want to build a debug tool to monitor the app, pause execution when bad things occur. Dev can continue ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    Want to build a debug tool to monitor the app, pause execution when bad things occur. Dev can continue ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    I'm trying to open up a PDF as an image using Wand. If I run the code below in Jupyter Notebook ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    As the title says, why does my html template look different on three different screen sizes? I understand ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    If I use socket.makefile and then close the file object as well as the underlying socket, then subsequent ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
...