第一個問題:android-apt plugin is incompatible with future version of Android Gradle plugin. use 'annotationPro
Warning:android-apt plugin is incompatible with future version of Android Gradle plugin. Please use ‘annotationProcessor’ configuration instead.
原因:更新Android studio 原來項目出現問題。
分析: 尤其是採用butterknife工具的,採用新的Android Studio都會出現這樣的問題,本人根據提示最後猜測原因可能是Android studio更新,然後gradle更新了,這樣的話可能使原來的android-apt 工具跟不上節奏了,所以讓採用annotationProcessor工具。
解決: 把project下的build.gradle 當中的依賴
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.4.0-alpha7’
classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’
}
}
修改成如下:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.4.0-alpha7’
}
}
然後再把module下的build.gradle :
dependencies {
compile project(‘:roadvance-sdk’)
compile ‘com.google.dagger:dagger:2.10’
apt ‘com.google.dagger:dagger-compiler:2.10’
compile ‘com.android.support:appcompat-v7:25.3.1’
compile ‘com.jakewharton:butterknife:8.5.1’
apt ‘com.jakewharton:butterknife-compiler:8.5.1’
}
修改如下:
dependencies {
compile project(‘:roadvance-sdk’)
compile ‘com.google.dagger:dagger:2.10’
annotationProcessor ‘com.google.dagger:dagger-compiler:2.10’
compile ‘com.android.support:appcompat-v7:25.3.1’
compile ‘com.jakewharton:butterknife:8.5.1’
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.5.1’
}
再把 apply plugin: ‘com.neenbedankt.android-apt ’ 這個引用給刪除。
重新reBuild的一下
第二個問題:解決Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
這個問題是Android studio升級到3.0之後,運行的時候會提示gradle要升級到3.5版本才能編譯。於是我把我的gradle升級到了
classpath 'com.android.tools.build:gradle:3.0+'
minSdkVersion :***