使用 android-apt 时无法将我的 android 代码升级到 gradle 3.5.3
Unable to Upgrade my android code to gradle 3.5.3 while using android-apt
我无法将代码升级到 gradle 3.5.3,当我尝试时出现了很多错误。
这是我的旧代码 app.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.fiapps.alquran.tafseer"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
apt "org.androidannotations:androidannotations:3.2"
compile "org.androidannotations:androidannotations-api:3.2"
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.4'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'com.google.code.gson:gson:2.8.2'
}
和这个老project.gragle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
repositories {
mavenLocal()
mavenCentral()
}
我更新了代码app.gradle但是还是有很多问题
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "my.package.here"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
applicationVariants.all { variant ->
variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions.arguments =
['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath,
'resourcePackageName': android.defaultConfig.applicationId]
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "org.androidannotations:androidannotations:4.6.0"
implementation "org.androidannotations:androidannotations-api:4.6.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'commons-io:commons-io:2.6'
implementation 'com.koushikdutta.ion:ion:2.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.dagger:dagger:2.25.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.25.4'
annotationProcessor 'com.google.auto.value:auto-value:1.7'
}
并更新了 project.gragle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
repositories {
mavenLocal()
mavenCentral()
}
我从堆栈中尝试了很多代码但没有成功请问如何解决问题
我刚刚在应用中添加了下面一行 gradle 现在它正在运行 here is 完整讨论。
annotationProcessor "org.androidannotations:otto:4.6.0"
我无法将代码升级到 gradle 3.5.3,当我尝试时出现了很多错误。
这是我的旧代码 app.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.fiapps.alquran.tafseer"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
apt "org.androidannotations:androidannotations:3.2"
compile "org.androidannotations:androidannotations-api:3.2"
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.4'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'com.google.code.gson:gson:2.8.2'
}
和这个老project.gragle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
repositories {
mavenLocal()
mavenCentral()
}
我更新了代码app.gradle但是还是有很多问题
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "my.package.here"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
applicationVariants.all { variant ->
variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions.arguments =
['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath,
'resourcePackageName': android.defaultConfig.applicationId]
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "org.androidannotations:androidannotations:4.6.0"
implementation "org.androidannotations:androidannotations-api:4.6.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'commons-io:commons-io:2.6'
implementation 'com.koushikdutta.ion:ion:2.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.dagger:dagger:2.25.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.25.4'
annotationProcessor 'com.google.auto.value:auto-value:1.7'
}
并更新了 project.gragle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
repositories {
mavenLocal()
mavenCentral()
}
我从堆栈中尝试了很多代码但没有成功请问如何解决问题
我刚刚在应用中添加了下面一行 gradle 现在它正在运行 here is 完整讨论。
annotationProcessor "org.androidannotations:otto:4.6.0"