2017-11-15 4 views
0

내가 안드로이드 스튜디오에서 butterknife 플러그인을 사용하려고하지만 다음과 같은 오류가 계속 : butterknife의 GitHub의에 나는 다음과했던안드로이드 butterknife 작동하지 및 안드로이드 스튜디오 3.0

Error: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.

모든 단계를 .

응용 프로그램

apply plugin: 'com.android.application' 
apply plugin: 'com.jakewharton.butterknife' 

android { 
    compileSdkVersion 26 
    defaultConfig { 
     applicationId "com.example.ilove.butterknifedemo" 
     minSdkVersion 16 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.1.0' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
    compile 'com.squareup:otto:1.3.8' 
    compile 'com.jakewharton:butterknife:8.8.1' 
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 
} 

프로젝트

buildscript { 

    repositories { 
     google() 
     jcenter() 
     mavenCentral() 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0' 
     classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1' 


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

allprojects { 
    repositories { 
     google() 
     jcenter() 
    } 
} 

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

ButterKnife Gradle 플러그인을 제거하면 작동하지만 필요할 경우 올바른 프로 가드 규칙을 추가하는 것을 잊지 마십시오. Protoard – EpicPandaForce

+0

Butterknife를 라이브러리에 의존하지 않고 프로젝트에 추가하려는 경우 EpicPandaForce가 답변 한대로 buil.gradle 프로젝트에 버터 나이프 플러그인과 클래스 경로 종속성을 제거하면됩니다. 모듈의 build.gradle 파일에 컴파일 및 주석 프로세서의 종속성을 추가하십시오. – Yajairo87

답변

0

변화 Gradle을 버전 : 3.0.0 2.3.3 아래 내가 프로젝트 수준 및 응용 프로그램 수준 Gradle을 파일 모두에 대해 가지고있는 코드입니다

dependencies { 
    classpath 'com.android.tools.build:gradle:2.3.3' 
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1' 


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