Gradle构建 - 无法确定任务的依赖关系':myLibrary:transformClassesAndResourcesWithProguardForRelease'

时间:2016-03-19 11:26:04

标签: android android-studio gradle android-library gradle-experimental

我刚刚将我的项目迁移到gradle-experimental:0.4.0以使用JNI。我已按照here

的说明进行操作

该项目由一个库和一个应用程序组成。我无法解决这个错误(尝试通常的清理和无效的缓存/重启):

Could not determine the dependencies of task ':myLibrary:transformClassesAndResourcesWithProguardForRelease'

库构建正常,但在构建应用程序模块时会出现此错误。以下是我修改过的build.gradle脚本:

项目:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle-experimental:0.4.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

图书馆(建立好):

apply plugin: 'com.android.model.library'

model
{
    android {
        buildToolsVersion="23.0.1"


        defaultConfig.with {
            minSdkVersion.apiLevel=16
            targetSdkVersion.apiLevel=16

            testInstrumentationRunner="android.test.InstrumentationTestRunner"
        }

    }

    android.buildTypes {
        release {
            minifyEnabled=true
            proguardFiles.add(file('proguard.cfg'))
        }
    }
}

App(此版本失败):

apply plugin: 'com.android.model.application'

dependencies {
    compile files('libs/GoogleAdMobAdsSdk-4.1.1.jar')
    compile project(':myLibrary')
}


model
{
    android
    {
        compileSdkVersion='Google Inc.:Google APIs:16'
        buildToolsVersion="23.0.1"

        defaultConfig.with {
            applicationId="my.app.ID"
            minSdkVersion.apiLevel=16
            targetSdkVersion.apiLevel=16
        }

    }

    android.buildTypes {
        release {
            minifyEnabled=true
            proguardFiles.add(file('proguard.cfg'))
        }
    }
}

移动到gradle-experimental时有没有人看到过这个错误?

1 个答案:

答案 0 :(得分:0)

好的,所以从库构建文件中删除proguard行修复了这个:

--proguardFiles.add(file('proguard.cfg'))