切换构建变量时缺少编译失败/导入(缺少aar依赖项)

时间:2016-03-07 16:12:20

标签: android android-studio android-gradle

每当我在android studio中切换buildvariant时,我所有的aar文件导入都会失败。为了让它再次运行,我需要做一件事或清除项目,更改gradle文件中的内容,重建或者如果所有内容都没有帮助使用' invalidate caches / restart"选项。有没有办法让它正常工作?

这是我的gradle文件:

apply plugin: 'com.android.application'

android {

compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "com.example.foo"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    versionName "1.0.0-SNAPSHOT"
}
buildTypes {
    debug {
        debuggable true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    release {
        debuggable false
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
    a {
        applicationId "com.example.foo.a"
        versionName "-a"
    }
    b {
        applicationId "com.example.foo.b"
        versionName "-b"
    }
    c {
        applicationId "com.example.foo.c"
        versionName "-c"
    }
    d {
        applicationId "com.example.foo.d"
        versionName "-d"
    }
}
}
dependencies {
 compile fileTree(dir: 'libs', include: '*.jar')
 compile 'com.android.support:support-v4:23.1.1'
 compile 'com.android.support:appcompat-v7:23.1.1'
 bCompile project(':some-aar-for-b-release')
 aCompile project(':some-aar-for-a-release')
 cCompile project(':some-aar-for-c-release')
 dCompile project(':some-aar-for-d-release')
}

0 个答案:

没有答案
相关问题