지원되지 않는 메서드 : 프로젝트 실행 중 AndroidProject.getPluginGeneration () Android Studio 2.2로

Android Studio 2.2로 프로젝트를 실행하려고하는데이 오류가 발생합니다.

Unsupported method: AndroidProject.getPluginGeneration().
The version of Gradle you connect to does not support that method.

ButterKnife 8.4.0을 사용하고 있습니다.

내 앱 gradle.file :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

내 모듈 gradle 파일 :

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "xxx.xx"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    compile 'com.jakewharton:butterknife:8.4.0'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
}

작동하지 않는 이유는 무엇이며 어떻게 해결합니까?



답변

일반적인 문제 :-

AS가 Instant Run 기능의 가용성을 확인했기 때문에 발생할 수 있습니다. 해결 방법은 Instant Run을 비활성화하는 것입니다.

Windows 및 Linux :

File -> Settings -> Build, Execution, Deployment -> Instant Run.

맥:

Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run.

여기에 이미지 설명 입력

이것을 언급 한 @pophus에게 감사드립니다.

버터 나이프를 사용하는 경우이 단계를 사용하십시오.

버전 2.2.0 이상에서 새 Jack 컴파일러를 사용하는 경우 ‘android-apt’플러그인이 필요하지 않으며 대신 컴파일러 종속성을 선언 할 때 apt를 annotationProcessor로 바꿀 수 있습니다.

즉, 제거

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

기본 gradle 파일에서

그리고 제거

apply plugin: 'android-apt'

기본 모듈 파일에서

교체

apt 'com.jakewharton:butterknife-compiler:8.4.0'

annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'


답변

Android Studio 2.2에서이 오류가 발생했습니다. 제 경우에는 AS가 Instant Run 기능의 가용성을 확인했기 때문입니다. Instant Run을 비활성화하여 수정했습니다.

Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run


답변

gradle 버전을 2.2로 변경

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
}


답변

Windows에서는

File / Settings/ Build, Execution, Deployment / Instant Run.

선택 취소 Enable Instant Run to hot swap code...


답변

단지 가까운 즉시 실행

Windows
파일-설정-빌드, 실행, 배포-즉시 실행.

MAC
Android Studio-> Preferences-> Build, Execution, Deployment-> Instant Run.


답변

아주 오래된 프로젝트에서 같은 오류가 발생했습니다. Android Studio 3.5에는 더 이상 Instant Run 옵션이 없으므로 다른 솔루션이 필요했습니다.

프로젝트 설정에서 수동으로 gradle 버전을 변경해야했습니다. 드롭 다운이 비어 있었기 때문에 새 프로젝트에서 자동으로 사용할 버전을 사용했습니다.

제 경우에는 플러그인 버전 3.5.1과 Gradle 버전 5.4.1이었습니다.

그 후 Build-Clean Project를 시작했고 모든 것이 잘되었습니다.


답변

Gradle 플러그인 버전을 마지막 버전으로 업그레이드하십시오.

dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'

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

Gradle이 마지막 v인지 확인하십시오.

#Sun Nov 03 16:47:32 IRST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

참고 : google저장소에서도 사용