首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在使用android-apt时将我的android代码升级到3.5.3级

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

Stack Overflow用户
提问于 2020-02-02 09:18:54
回答 1查看 195关注 0票数 0

当我尝试出现很多错误时,我无法将代码升级到gradle 3.5.3。

这里是我的旧代码app.gradle

代码语言:javascript
复制
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

代码语言:javascript
复制
// 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,但是仍然给出了很多问题

代码语言:javascript
复制
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

代码语言:javascript
复制
// 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()
}

我尝试了大量的堆栈代码,但没有成功,请解决问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-24 18:23:19

我刚在app gradle中添加了下面一行,现在它正在运行这是的完整讨论。

代码语言:javascript
复制
  annotationProcessor "org.androidannotations:otto:4.6.0"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60024715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档