오류 : (26, 0) Gradle DSL 방법을 찾을 수 없음 : 'runProguard ()'
gradle과 함께 Android Studio 0.9.3을 사용하고 있습니다. 'com.android.tools.build:gradle:0.14.+'
플러그인 적용 : '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 ()'
그것을 고치는 방법?
내가 아는 runProguard
한로 대체되었습니다 minifyEnabled
. 여전히 proguard에 대한 구성을 정의하는 방법을 잘 모르겠지만 Google 검색을 통해 알아낼 수 있습니다.
편집하다:
(가)의 경우 outFile
여기에 읽기 : https://groups.google.com/forum/#!topic/adt-dev/4_-5NvxuFB0 그들은 그것을 수행하는 방법에 대해 설명합니다.
요컨대, 그들은 더 복잡한 버전을 사용했습니다.
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 + "]");
}
}
Instead of using runProguard
in your gradle file, try using minifyEnabled
. This should fix the issue. runProguard
is deprecated and soon be stop working.
EDIT
To use minifyEnabled
, gradle should be updated to version 2.2 or above.
Change in the app build.gradle file may help:
old:
buildTypes {
release {
runProguard false // this line has to be changed
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
new:
buildTypes {
release {
minifyEnabled false // new version
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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.
Just add this.
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
minifyEnabled false
Means Build Type names cannot be main or androidTest (this is enforced by the plugin), and that they have to be unique to each other.
The new version of the Android Gradle
plugin, can automatically remove unused resources. The big win here is that it removes unused resources not just from your own code, but more importantly from libraries you are using (e.g. where there are resources included to support features that you are not actually using from your app).
As of Gradle 0.14.4, these errors are reported as compile-time errors.
So you have to replace runProguard false/true
with minifyEnabled false/true
The changes are listed on Android Developers Blog.
Migrating Gradle Projects to version 1.0.0 needs some easy renaming work, everything is described here: http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0
For proguard you can simply rename 'runProguard' => 'minifyEnabled', for the others see below:
Renamed Properties in BuildTypes:
runProguard => minifyEnabled
zipAlign => zipAlignEnabled
jniDebugBuild => jniDebuggable
renderscriptDebug => renderscriptDebuggable
Renamed Properties in ProductFlavors:
flavorGroups => flavorDimensions
packageName => applicationId
testPackageName => testApplicationId
renderscriptSupportMode => renderscriptSupportModeEnabled
ProductFlavor.renderscriptNdkMode => renderscriptNdkModeEnabled
Other Name changes
InstrumentTest was renamed to androidTest.
This is due to the update of the gradle android tools to 0.14.3. Into your file "build.gradle" replace
classpath 'com.android.tools.build:gradle:0.14.+'
by:
classpath 'com.android.tools.build:gradle:0.14.2'
Until they fix it…
runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project.
참고URL : https://stackoverflow.com/questions/27016385/error26-0-gradle-dsl-method-not-found-runproguard
'development' 카테고리의 다른 글
elasticsearch bool 쿼리는 OR과 결합해야합니다 (0) | 2020.06.24 |
---|---|
각 목록 항목 뒤에 이미지 삽입 (0) | 2020.06.24 |
특정 조건을 기다릴 때 WebDriver로 웹 페이지 새로 고침 (0) | 2020.06.24 |
URL에서 프로토콜 + 호스트 이름 가져 오기 (0) | 2020.06.24 |
Google Analytics의 개발 작업을 조회수로 삼는 방법이 있습니까? (0) | 2020.06.24 |