在使用android-apt时无法将我的android代码升级到gradle 3.5.3

问题描述 投票:0回答:1

当我尝试发生许多错误时,我无法将代码升级到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()
}

我尝试了很多代码,但是没有成功,请如何解决问题,请

android-studio android-gradle-plugin android-build android-apt android-variants
1个回答
0
投票

我刚刚在应用程序gradle中添加了以下内容,现在它可以here is进行全面讨论。

  annotationProcessor "org.androidannotations:otto:4.6.0"
© www.soinside.com 2019 - 2024. All rights reserved.