2016-12-11 16 views
0

私はAndroid Studio 2.2.3とビルドツール24.0.2を使用しています。Androidスタジオでの注釈処理がありません

バターナイフを含むライブラリのいくつかは、私がコンパイルしようとしているアプリのbuild.gradleで注釈を使用しています。最初に私はこのエラーを取得する:

Gradleの同期に失敗しました:私は「ウィンドウを起動するASで

[8.4.0:butterknife-コンパイラcom.jakewharton]引数のメソッドannotationProcessorを()が見つかりませんでした設定を編集し、Annotation Processingにチェックを入れました。キャッシュをクリアしてAndroidを再起動しました。まだそのエラーを取得しています。

アプリケーションレベルのbuild.gradle:

buildscript { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.fabric.io/public' } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 
     classpath 'com.github.triplet.gradle:play-publisher:1.1.4' 
     //noinspection GradleDynamicVersion 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.fabric.io/public' } 
    } 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '3.1' 
    distributionUrl = distributionUrl.replace("bin", "all") 
} 

Modのレベルのbuild.gradle:

apply plugin: 'com.android.application' 
apply from: '../config/quality/quality.gradle' 
apply plugin: 'com.github.triplet.play' 
//TODO uncomment line below after adding fabric api secret and key to fabric.properties 
//apply plugin: 'io.fabric' 

android { 
    compileSdkVersion 24 
    buildToolsVersion '24.0.2' 
    defaultConfig { 
     applicationId 'com.murphysw.rosie' 
     minSdkVersion 16 
     targetSdkVersion 24 
     testInstrumentationRunner "${applicationId}.runner.RxAndroidJUnitRunner" 
     versionCode 1000 
     // Major -> Millions, Minor -> Thousands, Bugfix -> Hundreds. E.g 1.3.72 == 1,003,072 
     versionName '0.1.0' 
    } 
    signingConfigs { 
     // You must set up an environment var before release signing 
     // Run: export APP_KEY={password} 
     // TODO Add your release keystore in /keystore folder 
     release { 
      storeFile file('keystore/release.keystore') 
      keyAlias 'alias' 
      storePassword "$System.env.APP_KEY" 
      keyPassword "$System.env.APP_KEY" 
     } 

     debug { 
      storeFile file('keystore/debug.keystore') 
      keyAlias 'androiddebugkey' 
      storePassword 'android' 
      keyPassword 'android' 
     } 
    } 
    buildTypes { 
     release { 
      signingConfig signingConfigs.release 

      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 

      ext.betaDistributionReleaseNotesFilePath = 
        file('../crashlytics_release_notes.txt').absolutePath 
     } 

     debug { 
      versionNameSuffix " Debug" 
      debuggable true 
     } 
    } 
    sourceSets { 
     def commonTestDir = 'src/commonTest/java' 
     test { 
      java.srcDir commonTestDir 
     } 
     androidTest { 
      java.srcDir commonTestDir 
     } 
    } 
    //Needed because of this https://github.com/square/okio/issues/58 
    lintOptions { 
     warning 'InvalidPackage' 
    } 
    productFlavors { 
    } 
} 

play { 
    serviceAccountEmail = 'your-service-account-email' 
    pk12File = file('key.p12') 
    // By default publishes to Alpha channel 
    track = 'alpha' 
} 

dependencies { 
    final PLAY_SERVICES_VERSION = '9.6.1' 
// final SUPPORT_LIBRARY_VERSION = '25.0.1' 
    final SUPPORT_LIBRARY_VERSION = '24.0.2' 
    final RETROFIT_VERSION = '2.1.0' 
    final DAGGER_VERSION = '2.5' 
    final DEXMAKER_VERSION = '1.4' 
    final HAMCREST_VERSION = '1.3' 
    final ESPRESSO_VERSION = '2.2.1' 
    final RUNNER_VERSION = '0.4' 
    final BUTTERKNIFE_VERSION = '8.4.0' 
    final AUTO_VALUE_VERSION = '1.3' 
    final AUTO_VALUE_GSON_VERSION = '0.4.2' 
    def daggerCompiler = "com.google.dagger:dagger-compiler:$DAGGER_VERSION" 
    def jUnit = "junit:junit:4.12" 
    def mockito = "org.mockito:mockito-core:1.10.19" 
    // App Dependencies 
    compile "com.google.android.gms:play-services-gcm:$PLAY_SERVICES_VERSION" 
    compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION" 
    compile('com.squareup.sqlbrite:sqlbrite:0.8.0') 
    { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    } 
    compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION" 
    compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" 
    compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'io.reactivex:rxandroid:1.2.1' 
    compile 'io.reactivex:rxjava:1.1.6' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.jakewharton.timber:timber:4.1.2' 
    compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION" annotationProcessor "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION" 
    // Replace provided dependency below with official AutoValue once this issue is fixed 

    // https://github.com/google/auto/issues/268 
    provided "com.jakewharton.auto.value:auto-value-annotations:$AUTO_VALUE_VERSION" provided "com.ryanharter.auto.value:auto-value-gson:$AUTO_VALUE_GSON_VERSION" annotationProcessor "com.google.auto.value:auto-value:$AUTO_VALUE_VERSION" annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.4-rc2' 
    annotationProcessor "com.ryanharter.auto.value:auto-value-gson:$AUTO_VALUE_GSON_VERSION" annotationProcessor 'com.squareup:javapoet:1.7.0' 
    // https://github.com/rharter/auto-value-parcel/issues/64 
    compile "com.google.dagger:dagger:$DAGGER_VERSION" provided 'org.glassfish:javax.annotation:10.0-b28' 
    //Required by Dagger2 
    annotationProcessor daggerCompiler testAnnotationProcessor daggerCompiler androidTestAnnotationProcessor daggerCompiler 
    // Instrumentation test dependencies 
    androidTestCompile jUnit 
    androidTestCompile mockito 
    androidTestCompile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION" 
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:$ESPRESSO_VERSION") 
    { 
     exclude group: 'com.android.support', module: 'appcompat' 
     exclude group: 'com.android.support', module: 'support-v4' 
     exclude group: 'com.android.support', module: 'recyclerview-v7' 
    } 
    androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION" 
    androidTestCompile "com.android.support.test:runner:$RUNNER_VERSION" 
    androidTestCompile "com.android.support.test:rules:$RUNNER_VERSION" 
    androidTestCompile "com.crittercism.dexmaker:dexmaker:$DEXMAKER_VERSION" 
    androidTestCompile "com.crittercism.dexmaker:dexmaker-dx:$DEXMAKER_VERSION" 
    androidTestCompile "com.crittercism.dexmaker:dexmaker-mockito:$DEXMAKER_VERSION" 
    // Unit tests dependencies 
    testCompile jUnit testCompile mockito testCompile "org.hamcrest:hamcrest-core:$HAMCREST_VERSION" testCompile "org.hamcrest:hamcrest-library:$HAMCREST_VERSION" testCompile "org.hamcrest:hamcrest-integration:$HAMCREST_VERSION" testCompile 'org.robolectric:robolectric:3.1' 
} 

// Log out test results to console 
tasks.matching {it instanceof Test}.all { 
    testLogging.events = ["failed", "passed", "skipped"] 
} 
+0

build.gradleのgradleバージョンはどのように設定されていますか?それは> 2.2ですか? – Bajal

答えて

1

butterknifeページには、この行を含めることが求められます。あなたは

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

ことを含んでいましたあなたのアプリレベルgradleで?

+0

私はRibotという会社のテンプレートプロジェクトを使用しています。広く使用されているので、問題はAndroid Studioの設定であると思われます。その行は含まれているようです。 ASには注釈プロセッサが定義されていないようです。この機能は以前はプラグインに含まれていたようだが、今は焼き込まれているはずだ。ありがとう! –

+0

Ribotテンプレートには数行の行がありませんでした。また、build.gradleファイルにはタスク間にいくつかの改行が必要でした。このライブラリの注釈処理を有効にするには、Butterknifeのインストール手順(https://github.com/JakeWharton/butterknife)に従ってください。 –

関連する問題