我是Android开发新手,接手了一个旧项目。因此我安装了最新版本的Android Studio并打开了它。
当我尝试构建它时,我遇到了这个错误:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
我尝试了这些线程中提供的解决方案,但都没有起作用。
我的grandle构建脚本中没有任何android-apt参考。
许多编译包都显示为过时。但是当我按照Android Studio的建议更新引用时,出现错误提示找不到该包。
正如我所说,我对Android Studio世界还很陌生,所以对这些东西有点迷茫。
这是我的build.gradle(Module: app):
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "xxxxxxxxxxxx"
minSdkVersion 19
targetSdkVersion 24
versionCode 123
versionName "1.2.3"
manifestPlaceholders = [HOCKEYAPP_APP_ID: "xxxxxxxxxxxxxxxxxxxxx"]
//For Test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.mikepenz:materialdrawer:4.6.4@aar') {
transitive = true
}
//For Test
androidTestCompile 'com.android.support:support-annotations:24.2.1'
//noinspection GradleCompatible
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-v13:24.2.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.p_v:flexiblecalendar:1.1.4'
compile 'br.com.zbra:android-linq:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'com.cardiomood.android:android-widgets:0.1.1'
compile 'com.github.thorbenprimke:realm-recyclerview:0.9.14'
compile 'net.hockeyapp.android:HockeySDK:4.0.0'
}
这是我的 build.gradle (Project: MyApp) 文件:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath "io.realm:realm-gradle-plugin:0.88.3"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}