1

我刚刚将我的项目迁移到 gradle-experimental:0.4.0 以使用 JNI。我已按照此处的说明进行操作

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

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 时看到这个错误?

4

1 回答 1

0

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

--proguardFiles.add(file('proguard.cfg'))
于 2016-03-20T13:15:42.410 回答