3

誰かがジャックコンパイラでAndroidアノテーションを使用する方法を知っていますか?Android Annotationsとそのアノテーションプロセッサーをジャックで使用する方法は?

build.gradle

Here私のアプリ/ build.gradleとhere私のプロジェクトこの構成では、私は私のプロジェクトをビルドするとき、私はこのエラーメッセージを持っている:

Error:Could not get unknown property 'classpath' for task ':app:transformJackWithJackForDebug' of type com.android.build.gradle.internal.pipeline.TransformTask. 

答えて

6

あなたはandroid-aptプラグインを削除する必要がありますaptブロックはジャック注釈処理では機能しないため、完全にブロックします。また、annotationProcessor構成のプロセッサを宣言する必要があります。最後に、アノテーション処理パラメータをジャック(which has no public API per-variant, yet)に追加する必要があります。

repositories { 
    jcenter() 
    mavenCentral() 
} 


apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.frlgrd.streamzone" 
     minSdkVersion 21 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     jackOptions { 
      enabled true 
     } 
    } 
    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_8 
     targetCompatibility JavaVersion.VERSION_1_8 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

// Android Annotations 
def AAVersion = '4.0.0' 

dependencies { 

    // Google 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.android.support:design:24.2.1' 

    // Android Annotations 
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion" 
    compile "org.androidannotations:androidannotations-api:$AAVersion" 

    // RX 
    compile 'com.tbruyelle.rxpermissions:rxpermissions:[email protected]' 
    compile 'io.reactivex:rxandroid:1.2.1' 
    compile 'io.reactivex:rxjava:1.1.6' 
} 

// add annotation processing options to jack 
android.applicationVariants.all { variant -> 
    variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions 
      .arguments = ['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath] 
} 
+1

おかげで、それが動作:

はここにあなたの修正build.gradleです! –

+0

私のために働かない( 'compileSdkVersion 25'、' buildToolsVersion '25 .0.2''、 'targetSdkVersion 23'、' AAVersion = '4.2.0'') – BornToCode

+0

@BornToCodeあなたは何を得ていますか? – WonderCsabo

関連する問題