博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
找不到Gradle DSL方法:'runProguard'
阅读量:2381 次
发布时间:2019-05-10

本文共 3874 字,大约阅读时间需要 12 分钟。

本文翻译自:

I get an error after updating from my last project. 从我上一个项目更新后出现错误。 Not a problem in my code but I'm having trouble with build.gradle. 我的代码不是问题,但我在build.gradle时遇到问题。 How can I fix it? 我该如何解决?

build.gradle code here: build.gradle代码在这里:

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 Sync message output: Gradle Sync消息输出:

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**

#1楼

参考:


#2楼

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. 如果您使用的是gradle插件的0.14.0或更高版本,则应在build.gradle文件中将“ runProguard”替换为“minifyEnabled”

runProguard was renamed to minifyEnabled in version 0.14.0. runProguard更名为minifyEnabled在0.14.0版本。 For more info, 有关更多信息,


#3楼

Using 'minifyEnabled' instead of 'runProguard' works properly. 使用'minifyEnabled'而不是'runProguard'可以正常工作。

Previous code:

buildTypes {        release {            runProguard false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'        }    }

Current code:

buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'        }    }

Hope this helps. 希望这可以帮助。


#4楼

If you are migrating to 1.0.0 you need to change the following properties. 如果要迁移到1.0.0,则需要更改以下属性。

In the Project's build.gradle file you need to replace minifyEnabled. 在Project的build.gradle文件中,您需要替换minifyEnabled。

Hence your new build type should be 因此,您的新构建类型应该是

buildTypes {    release {        minifyEnabled true        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'            }}

Also make sure that gradle version is 1.0.0 like 还要确保gradle版本是1.0.0之类的

classpath 'com.android.tools.build:gradle:1.0.0'

in the build.gradle file. build.gradle文件中。

This should solve the problem. 这应该可以解决问题。

Source: 资料来源: :


#5楼

By changing runProguard to minifyEnabled , part of the issue gets fixed. 通过将runProguard更改为minifyEnabled ,可以解决部分问题。

But the fix can cause "Library Projects cannot set application Id" (you can find the fix for this here ). 但修复可能导致“库项目无法设置应用程序ID”(您可以在此处找到的修复程序, )。

By removing application Id in the build.gradle file, you should be good to go. 通过删除build.gradle文件中的应用程序ID,您应该很高兴。


#6楼

runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) or more in Gradle. runProguard已在Gradle版本0.14.0(2014/10/31)或更高版本中重命名为minifyEnabled

To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project. 要解决此问题,您需要在项目的build.gradle文件中将runProguard更改为minifyEnabled。

转载地址:http://suexb.baihongyu.com/

你可能感兴趣的文章
java操作Access *.mdb数据库的实现
查看>>
jdbc连接数据库的代码片段
查看>>
X86汇编:debug命令详解
查看>>
flex(通过URLLoader)与后台jsp进行交互的例子,包括中文乱码的处理
查看>>
Flex HTTPService如何给后台传递参数
查看>>
Flex取得客户端的IP地址
查看>>
不vista下安装oracle10g(r2)注意事项
查看>>
文件列表输出到文件
查看>>
Ubuntu(804) SSH远程管理服务器安装配置
查看>>
android源码
查看>>
使用Hadoop的JAVA API远程访问HDFS
查看>>
Linux下任务调度服务crond使用
查看>>
ZeroMQ的订阅发布(publish-subscribe)模式
查看>>
使用redis存储全球IP库
查看>>
Snappy Java API简介
查看>>
C/C++中正则表达式库RE2的使用
查看>>
HBase Java API(1.2.X)使用简介
查看>>
Java:实现比较接口时,应该全面的进行各种情况的比较
查看>>
python3.*下用mob_pbxproj自动化修改配置
查看>>
使用fir打包,测试跳转安装的坑
查看>>