Error:(26, 0) Gradle DSL method not found: #39;runProguard()#39;(错误:(26, 0) 找不到 Gradle DSL 方法:runProguard())
问题描述
我正在使用带有 gradle 的 android studio 0.9.3 'com.android.tools.build:gradle:0.14.+'
I'm using android studio 0.9.3 with gradle 'com.android.tools.build:gradle:0.14.+'
应用插件:'com.android.application'
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "xxx.xxx.xxx"
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.0.11"
}
signingConfigs{
releaseConfig{
storeFile file("xxxxxxx")
storePassword = "xxxx"
keyAlias = "xxxx"
keyPassword = "xxxx"
}
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
// adds version to file name
applicationVariants.all { variant ->
def file = variant.outputFile
variant.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Google Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.mcxiaoke.volley:library:1.0.6'
compile 'com.google.code.gson:gson:2.2.+'
}
之前编译的项目没有对该文件进行任何更改,我越来越:错误:(26, 0) Gradle DSL 方法未找到:'runProguard()'
The project compiled before without any changes in that file,
I'm getting:
Error:(26, 0) Gradle DSL method not found: 'runProguard()'
如何解决?
推荐答案
据我所知 runProguard
被替换为 minifyEnabled
.我仍然不确定如何为 proguard 定义配置,但 Google 搜索应该可以帮助您找出答案.
As far as I know runProguard
was replaced with minifyEnabled
. I am still not sure how to define the config for proguard but a Google search should help you to find out.
对于 outFile
,请阅读此处:https://groups.google.com/forum/#!topic/adt-dev/4_-5NvxuFB0 他们是怎么做的.
For the outFile
read here: https://groups.google.com/forum/#!topic/adt-dev/4_-5NvxuFB0 how they do it.
简而言之:他们使用了更复杂的版本:
In short: they used a more complex version:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def apk = output.outputFile;
def newName;
// newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-" + variant.buildType.name.toUpperCase() + ".apk");
if (variant.buildType.name == "release") {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-release.apk");
} else {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-beta.apk");
}
output.outputFile = new File(apk.parentFile, newName);
if (output.zipAlign) {
output.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
logger.info('INFO: Set outputFile to ' + output.outputFile + " for [" + output.name + "]");
}
}
这篇关于错误:(26, 0) 找不到 Gradle DSL 方法:'runProguard()'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:错误:(26, 0) 找不到 Gradle DSL 方法:'runProguard()
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01