5

안드로이드 스튜디오 3.0에 Gradle을 오류 안드로이드 스튜디오 3.0로 업그레이드 한 후 나는 할 수 없습니다, 내가 websiteButterknife 인해 안드로이드-APT 플러그인

그러나 개발자에 확인 해결할 수 있었다 Gradle을 몇 가지 문제가 있었다 apply plugin: 'android-apt'으로 문제를 해결하는 방법을 찾으십시오. 프로젝트 gradle에서 제거하고 응용 프로그램 gradle에 추가하는 등 여러 가지 작업을 시도했습니다 (annotationProcessor 'com.neenbedankt.gradle.plugins:android-apt:1.8'). 또한 아파트 등을 제거했습니다.

어쨌든 Studio에서 불만을 제기하고 있습니다. 어떤 도움이라도 대단히 감사합니다. 감사!

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
     classpath 'com.google.gms:google-services:3.1.1' 

    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     google() 
     maven { url "https://jitpack.io" } 
    } 

    ext { 
     supportLibVersion = '27.0.0' 
     firebaseLibVersion = '11.4.2' 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

APP Gradle을

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 27 
    buildToolsVersion "27.0.0" 
    defaultConfig { 
     applicationId "xxxxxxxxxxxxxxxxxxxx" 
     minSdkVersion 17 
     targetSdkVersion 27 
     versionCode 1 
     versionName "1.0" 

     vectorDrawables.useSupportLibrary = true 

    } 

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

    apply plugin: 'android-apt' 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 

    compile "com.android.support:appcompat-v7:${supportLibVersion}" 
..... 

    compile 'com.google.android.gms:play-services-auth:11.4.2' 

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

} 
apply plugin: 'com.google.gms.google-services' 
+0

대신'annotationProcessor'를 사용하고'classpath '를 제거하십시오. com.neenbedankt.gradle.plugins : android-apt : 1.8'' – Raghunandan

+0

그것이 작동하지 않는 이유에 대한 자세한 내용은 'apt'는 더 이상 지원되지 않습니다. – Sharj

답변

6

이 같은 종속성을 추가, APT 플러그인을 사용하지 마십시오 : 당신이 급한 경우 당신이 그 일을 비활성화 할 수 있습니다

compile "com.jakewharton:butterknife:8.8.1" 
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1" 

Reference

+0

이 문제를 해결 한 것으로 보입니다 – Javi

+0

[원본 문제 스레드] (https://github.com/JakeWharton/butterknife/issues/963#issuecomment-342400475) – Aks4125

0

을 . 문서

새 의존성 해상도 전략으로 마이그레이션 문제가있는 경우 당으로

, 당신은 진정한 includeCompileClasspath을 설정하여 안드로이드 플러그인 2.3.0의에 동작을 복원 할 수 있습니다. 그러나 버전 2.3.0으로 동작을 복원하는 것은 좋지 않습니다.

android { 
    ... 
    defaultConfig { 
     ... 
     javaCompileOptions { 
      annotationProcessorOptions { 
       includeCompileClasspath false 
      } 
     } 
    } 
} 

그리고 한 가지 더 당신은 Gradle을 파일에 buildTypes 태그 flavorDimensions "default" 속성을 정의해야합니다.

자세한 내용은 here에서 확인할 수 있습니다.

관련 문제