找不到 Gradle DSL 方法:'runProguard' [英] Gradle DSL method not found: 'runProguard'

查看:22
本文介绍了找不到 Gradle DSL 方法:'runProguard'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从上一个项目更新后出现错误.我的代码没有问题,但我在使用 build.gradle 时遇到了问题.我该如何解决?

I get an error after updating from my last project. Not a problem in my code but I'm having trouble with build.gradle. How can I fix it?

这里的build.gradle代码:

build.gradle code here:

apply plugin: 'android'

android {
    compileSdkVersion 21
    buildToolsVersion '20.0.0'

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

    defaultConfig {
        applicationId 'com.xxx.axxx'
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 6
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile files('libs/commons-codec-1.8.jar')
    compile files('libs/asmack-android-8-4.0.4.jar')
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.jakewharton:butterknife:5.1.1'
}

Gradle 同步消息输出:

Gradle Sync message output:

Error:(27, 0) Gradle DSL method not found: 'runProguard()'
**Possible causes:
The project 'Atomic4Mobile' may be using a version of Gradle that does not contain the method.
**Gradle settings**
The build file may be missing a Gradle plugin.
**Apply Gradle plugin**

推荐答案

如果您使用的是 0.14.0 或更高版本的 gradle 插件,则应替换 "runProguard""minifyEnabled" 在你的 build.gradle 文件中.

If you are using version 0.14.0 or higher of the gradle plugin, you should replace "runProguard" with "minifyEnabled" in your build.gradle files.

runProguard 在 0.14.0 版本中更名为 minifyEnabled.如需更多信息,查看 Android 构建系统

runProguard was renamed to minifyEnabled in version 0.14.0. For more info, See Android Build System

这篇关于找不到 Gradle DSL 方法:'runProguard'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆