Programing

Gradle DSL 방법을 찾을 수 없음 : 'runProguard'

lottogame 2020. 2. 13. 00:24
반응형

Gradle DSL 방법을 찾을 수 없음 : 'runProguard'


마지막 프로젝트에서 업데이트 한 후 오류가 발생합니다. 내 코드에는 문제가 없지만 build.gradle에 문제가 있습니다. 어떻게 고칠 수 있습니까?

여기 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 메시지 출력 :

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

여기에 이미지 설명을 입력하십시오gradle 플러그인의 버전 0.14.0 이상을 사용하는 경우 build.gradle 파일에서 "runProguard""minifyEnabled" 로 바꿔야합니다.

runProguard은 이름이 바뀌 었습니다 minifyEnabled 버전 0.14.0에서. 자세한 정보는 Android 빌드 시스템을 참조하십시오.


사용 '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'
        }
    }

도움이 되었기를 바랍니다.


1.0.0으로 마이그레이션하는 경우 다음 특성을 변경해야합니다.

프로젝트의 build.gradle 파일 에서 minifyEnabled 를 바꿔야합니다.

따라서 새로운 빌드 유형은

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

또한 gradle 버전이 1.0.0과 같은지 확인하십시오

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

에서 build.gradle의 파일.

문제를 해결해야합니다.

출처 : http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0


runProguardminifyEnabled 로 변경 하면 문제의 일부가 해결됩니다.

그러나 수정으로 인해 "라이브러리 프로젝트에서 애플리케이션 ID를 설정할 수 없습니다"가 발생할 수 있습니다 ( Android Studio 1.0 에서이 수정 사항을 찾을 수 있으며 "라이브러리 프로젝트에서 applicationId를 설정할 수 없음"오류가 발생 함 ).

build.gradle 파일에서 애플리케이션 ID를 제거하면 좋습니다.


runProguard의 이름이 Gradle 에서 버전 0.14.0 (2014/10/31) 이상에서 minifyEnabled 로 바뀌 었습니다 .

이 문제를 해결하려면 프로젝트 build.gradle 파일 에서 runProguard를 minifyEnabled로 변경해야합니다 .

여기에 이미지 설명을 입력하십시오

참고 URL : https://stackoverflow.com/questions/27078075/gradle-dsl-method-not-found-runproguard



반응형