【问题标题】:android gradle how do I link with debug libraryandroid gradle 如何与调试库链接
【发布时间】:2017-08-18 22:27:18
【问题描述】:

我正在尝试构建一个库,该库在构建应用程序的发布版本时链接到我的库的调试版本,在构建调试应用程序时链接到调试版本。它似乎只链接到发布版本。
我的布局是
应用程序/src/...
图书馆/src...
我的 .aar 文件构建正常。他们是:
./thelibrary/build/outputs/aar/thelibrary-debug.aar
./thelibrary/build/outputs/aar/thelibrary-release.aar

app build.gradle 是:

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')
}

我想链接到调试模式下的 -debug 库和发布模式下的 -release 库。

【问题讨论】:

    标签: java android gradle build dependencies


    【解决方案1】:

    【讨论】:

    • 我可能会错过它,但这似乎并不能回答我的问题。我的问题是库模块创建了两个 .aar 文件:一个用于调试,另一个用于发布,但应用程序仅使用 .aar 文件的 -release 版本,我找不到 thelibrary/build/outputs/ 之间的链接aar/*.aar 和 app/build.gradle。我希望它在我的根 build.gradle 中,但我找不到如何创建该连接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-04
    • 1970-01-01
    • 1970-01-01
    • 2010-11-10
    • 2012-04-17
    • 1970-01-01
    • 2019-03-18
    相关资源
    最近更新 更多