Android的工作室更新后:摇篮DSL方法未找到:'runProguard()摇篮、未找到、工作室、方法

2023-09-05 06:22:37 作者:认真你就输了

我刚刚更新了我的机器人工作室,现在我的项目将无法生成了。我收到以下错误:

I've just updated my Android Studio and now my project won't build anymore. I get following error:

Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the  method.
<a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

我没有改变任何东西,一切都在更新前工作,妥善。这是我的 build.gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.ochs.pipette"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 8
        versionName "1.6"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'it.sephiroth.android.library.imagezoom:library:1.0.4'
    compile 'com.android.support:palette-v7:21.0.+'
}

和这里的另一个:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0-rc2'

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

allprojects {
    repositories {
        jcenter()
    }
}

我不知道如何解决这个问题,谁能帮我?

I don't know how to fix the problem, could anyone help me?

推荐答案

runProguard 已更名为 minifyEnabled 。请参见更改日志这里确认 - 版本0.14.0(2014年10月31号)摇篮插件做了交换。

runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the gradle plugin made the swap.