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.

steven smith
  • 1,519
  • 15
  • 31

1 Answers1

0

It is a duplicate question.

gradle doc

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

Community
  • 1
  • 1
redAllocator
  • 725
  • 6
  • 12
  • 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. – steven smith Mar 28 '17 at 20:13