将构建gradle版本升级到v3.1.3后,构建失败并显示以下错误。
android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
但是,我从gradle文件中删除了所有 android-apt 使用。
我尝试了stackoverflow和论坛中所有可能的解决方案。但是不走运。
下面是我的应用模块的 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 28
buildToolsVersion '28.0.1'
defaultConfig {
applicationId "com.appname.test"
minSdkVersion 19
targetSdkVersion 28
versionCode 24
versionName "1.5.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "AUTH0_DEV_DOMAIN", AUTH0_DEV_DOMAIN
resValue "string", "AUTH0_DEV_CLIENT_ID", AUTH0_DEV_CLIENT_ID
resValue "string", "AUTH0_DEV_SCHEME", AUTH0_DEV_SCHEME
resValue "string", "AUTH0_DEV_AUDIENCE", AUTH0_DEV_AUDIENCE
resValue "string", "AUTH0_PROD_DOMAIN", AUTH0_PROD_DOMAIN
resValue "string", "AUTH0_PROD_CLIENT_ID", AUTH0_PROD_CLIENT_ID
resValue "string", "AUTH0_PROD_SCHEME", AUTH0_PROD_SCHEME
resValue "string", "AUTH0_PROD_AUDIENCE", AUTH0_DEV_AUDIENCE
}
dexOptions {
// incremental true
javaMaxHeapSize "4g"
}
buildTypes {
debug {
buildConfigField "String", "ENDPOINT", "\"https://domine url/\""
ext.alwaysUpdateBuildId = false
}
release {
buildConfigField "String", "ENDPOINT", "\"https://domine url/\""
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
/* configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
}
*/
/*compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}*/
productFlavors {
}
}
retrolambda {
jvmArgs '-noverify'
}
final ANNOTATIONS_VERSION = '28.0.0' //'26.0.0'
final SUPPORT_VERSION = '28.0.0' //'26.0.0'
final RX_JAVA_VERSION = '1.1.6'
final RX_ANDROID_VERSION = '1.2.1'
final BUTTERKNIFE_VERSION = '8.8.1'
final DAGGER_VERSION = '2.2'
final PARCELER_VERSION = '1.1.5'
final DEXTER_VERSION = '2.2.2'
final OTTO_VERSION = '1.3.8'
final ICEPICK_VERSION = '3.2.0'
final TIMBER_VERSION = '4.1.2'
final RETROFIT_VERSION = '2.4.0'
//final PICASSO_VERSION = '2.5.2'
final DEXMAKER_VERSION = '1.2'
final RUNNER_VERSION = '1.0.2' //'0.4'
final ESPRESSO_VERSION = '3.0.2' //'2.2.2'
//////
//final RX_JAVA_VERSION = '1.3.8'
final RX_BINDING_VERSION = '1.0.0' // 2.2.0
//final DAGGER_VERSION = '2.17'
//final PARCELER_VERSION = '1.1.11'
//final DEXTER_VERSION = '5.0.0'
//final TIMBER_VERSION = '4.7.1'
final PICASSO_VERSION = '2.71828'
final MOCKITO_CORE_VERSION = '2.7.22'
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
// Support library for android.
implementation "com.android.support:support-annotations:${ANNOTATIONS_VERSION}"
implementation "com.android.support:appcompat-v7:${SUPPORT_VERSION}"
implementation "com.android.support:support-v4:${SUPPORT_VERSION}"
implementation "com.android.support:design:${SUPPORT_VERSION}"
implementation "com.android.support:cardview-v7:${SUPPORT_VERSION}"
implementation "com.android.support:palette-v7:${SUPPORT_VERSION}"
// dependency added to resolve conflict with auth0 customtabs
// dependency using version 25
implementation "com.android.support:customtabs:${SUPPORT_VERSION}"
// Library needed for custom tab views.
//implementation 'com.ogaclejapan.smarttablayout:library:1.6.0@aar'
implementation 'com.ogaclejapan.smarttablayout:library:1.6.1'
// Library for listview and gridview item animations
//implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0'
// Library needed for carousel views.
implementation 'com.github.crosswall:Android-Coverflow:release-v1.0.1'
// Library needed for horizontal line progress bar.
implementation 'com.liulishuo.magicprogresswidget:library:1.1.1'
// Library to eliminate findViewById and OnClick events (View injection).
implementation "com.jakewharton:butterknife:${BUTTERKNIFE_VERSION}"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}"
// Library which manages the DI throughout android.
implementation "com.google.dagger:dagger:${DAGGER_VERSION}"
annotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
// compileOnly 'javax.annotation:jsr250-api:1.0'
//compileOnly 'javax.annotation:jsr250-api:1.0-20050927.133100'
// Library that eliminates the boilerplate code of creating Parcelable objects.
implementation "org.parceler:parceler-api:${PARCELER_VERSION}"
annotationProcessor "org.parceler:parceler:${PARCELER_VERSION}"
// Library that eliminates the boilerplate code of granting permissions.
implementation "com.karumi:dexter:${DEXTER_VERSION}"
// Library for reactive java
implementation "io.reactivex:rxjava:${RX_JAVA_VERSION}"
implementation "io.reactivex:rxandroid:${RX_ANDROID_VERSION}"
implementation 'com.cantrowitz:rxbroadcast:1.0.0'
// implementation 'com.cantrowitz:rxbroadcast:2.2.0'
implementation "com.jakewharton.rxbinding:rxbinding:${RX_BINDING_VERSION}"
implementation "com.jakewharton.rxbinding:rxbinding-support-v4:${RX_BINDING_VERSION}"
// Library to be used as an event bus.
implementation "com.squareup:otto:${OTTO_VERSION}"
// Library for efficient logging.
implementation "com.jakewharton.timber:timber:${TIMBER_VERSION}"
// Retrofit library used to manage request asynchronously.
implementation "com.squareup.retrofit2:retrofit:${RETROFIT_VERSION}"
implementation "com.squareup.retrofit2:converter-gson:${RETROFIT_VERSION}"
implementation "com.squareup.retrofit2:adapter-rxjava:${RETROFIT_VERSION}"
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
// Library to load images.
implementation "com.squareup.picasso:picasso:${PICASSO_VERSION}"
// Library for bottom navigation menu.
implementation 'com.roughike:bottom-bar:1.4.0.1'
implementation 'com.ncapdevi:frag-nav:1.0.3'
implementation('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
//implementation 'me.relex:circleindicator:1.2.1@aar'
implementation 'me.relex:circleindicator:1.2.2'
implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
// Library for authentication with Auth0.
//implementation 'com.auth0.android:auth0:1.12.1'
implementation 'com.auth0.android:auth0:1.14.1'
// implementation 'com.klinkerapps:link_builder:1.6.1'
implementation 'com.klinkerapps:link_builder:2.0.4'
// Library for ui tag view layout
implementation 'com.github.Cutta:TagView:1.3'
// Library for timeline view
implementation 'com.github.vipulasri:timelineview:1.0.6'
//++ implementation 'com.github.vipulasri:timelineview:1.0.4'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
implementation 'com.airbnb:deeplinkdispatch:3.0.0'
annotationProcessor 'com.airbnb:deeplinkdispatch-processor:3.0.0'
testImplementation 'junit:junit:4.12'
// testImplementation 'com.google.truth:truth:0.25'
testImplementation 'com.google.truth:truth:0.42'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.11.0'
testImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
//++ testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'org.robolectric:robolectric:3.4.2'
testImplementation 'org.assertj:assertj-core:3.6.2'
testImplementation 'org.json:json:20180813'
// Support library for android.
androidTestImplementation "com.android.support:support-annotations:${ANNOTATIONS_VERSION}"
// Library for the test runner
androidTestImplementation "com.android.support.test:runner:${RUNNER_VERSION}"
androidTestImplementation "com.android.support.test:rules:${RUNNER_VERSION}"
// not available
// Library for UI testing
androidTestImplementation "com.android.support.test.espresso:espresso-core:${ESPRESSO_VERSION}"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:${ESPRESSO_VERSION}"
// not available
// Library for mocking
androidTestImplementation "com.google.dexmaker:dexmaker:${DEXMAKER_VERSION}"
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${DEXMAKER_VERSION}"
//androidTestImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
// Library which manages the DI throughout android.
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
testAnnotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
androidTestImplementation "org.mockito:mockito-android:${MOCKITO_CORE_VERSION}"
implementation files('libs/nineoldandroids-2.4.0.jar')
}
以下是应用程序级别 build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "io.realm:realm-gradle-plugin:1.2.0"
classpath 'io.fabric.tools:gradle:1.22.1'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url "https://clojars.org/repo/" }
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
有人可以帮我解决。 我的Android Studio版本是3.2 我尝试了 clean ,重建,使工作室无效并重新启动,还重新启动计算机