Fra*_*and 3 android gradle annotation-processing jack android-annotations
有人知道如何使用插件编译器使用Android Annotations吗?
在这里我的app/build.gradle和这里我的项目build.gradle
使用此配置,我在构建项目时出现此错误消息:
Error:Could not get unknown property 'classpath' for task ':app:transformJackWithJackForDebug' of type com.android.build.gradle.internal.pipeline.TransformTask.
Run Code Online (Sandbox Code Playgroud)
您应该完全删除android-apt插件和apt块,因为它不适用于Jack注释处理.此外,您必须在annotationProcessor配置中声明处理器.最后,您必须将注释处理参数添加到jack(其中每个变体没有公共API).
这是您修改后的build.gradle:
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:0.7.1@aar'
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]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1633 次 |
| 最近记录: |