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

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

应用程序(此构建失败):
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 时看到这个错误?

最佳答案

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

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

关于android - Gradle build - 无法确定任务 ':myLibrary:transformClassesAndResourcesWithProguardForRelease' 的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36101110/

相关文章:

Android Studio 无法解析方法 requestLocationUpdates FusedLocationProviderAPI

java - 在 NavigationDrawer 中单击按钮打开 Activity

java - 具有不同替换和重命名规则的 gradle processResources

android - 从 Eclipse 迁移到 Android Studio : Attribute has already been defined

除第一项外,Android Ellipsize 选框不起作用

java - Android网页不刷新其内容

java - 错误 :Android Packager: [. ..] java.io.FileNotFoundException :. ..(权限被拒绝)

android - 设置按钮文本以匹配所有 Android 中的最小文本大小

java - Gradle - 将项目依赖项共享为 jar

Android Studio 安装更新失败(错误 : Failed to read or create install properties file.)