0

I'm trying to build a library that links to the debug version of my library when building the release version of the application and to the debug version when building the debug application. It seems to only link to the release version.
My layout is
app/src/...
thelibrary/src...
My .aar files build ok. They are:
./thelibrary/build/outputs/aar/thelibrary-debug.aar
./thelibrary/build/outputs/aar/thelibrary-release.aar

The app build.gradle is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.kana_tutor.dependenciesdemo"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
    testCompile 'junit:junit:4.12'
    compile project(path: ':thelibrary')
}

I would like to link to the -debug library in debug mode and the -release library in release mode.

1 Answer 1

0

It is a duplicate question.

gradle doc

How to set up gradle and android studio to do release build?

1
  • I may be missing it but this doesn't seem to answer my question. My problem is that the library module creates two .aar files: one for debug and another for release but the app only uses the -release version of the .aar file and I can't find the link between the thelibrary/build/outputs/aar/*.aar and the app/build.gradle. I expect it to be in my root build.gradle but I can't find how to create that connection. Mar 28, 2017 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.