编译和运行的区别_python打包成安卓app[通俗易懂]

编译和运行的区别_python打包成安卓app[通俗易懂]AndroidStudio3.12的一些坑1、android-aptpluginisincompatiblewiththeAndroidGradleplugin.Pleaseuse‘annotationProcesso

SparkYuan的CSDN博客地址:https://blog.csdn.net/L664675249/article/details/50783923
meizi的GitHub地址:https://github.com/SparkYuan/Meizi

1、android-apt plugin is incompatible with the Android Gradle plugin. Please use ‘annotationProcessor’ configuration instead.

第一个注释:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
//apply plugin: 'android-apt'

第二个修改:

//apt rootProject.ext.butterknifeCompiler
annotationProcessor rootProject.ext.butterknifeCompiler

第三个注释:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath "io.realm:realm-gradle-plugin:1.1.0"
    //classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}

然而Error仍然存在,从网上搜索,可能是realm的版本太低,于是升级到:

classpath "io.realm:realm-gradle-plugin:2.2.0"

这个Error终于消失。(其实还有另外的坑,继续往下看)

2、Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.

原代码:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile rootProject.ext.appcompatV7
    compile rootProject.ext.supportV4
    compile rootProject.ext.androiddesign
    compile rootProject.ext.recyclerview
    compile (rootProject.ext.realm){
       exclude group: 'org.ow2.asm', module: 'asm'
        exclude group: 'org.ow2.asm', module: 'asm-commons'
        exclude group: 'org.ow2.asm', module: 'asm-tree'
        exclude group: 'org.ow2.asm', module: 'asm-analysis'
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-runtime'
    }
    compile rootProject.ext.retrofit
    compile rootProject.ext.retrofitgson
    compile rootProject.ext.rxJava
    compile rootProject.ext.rxAndroid
    compile rootProject.ext.rxAdapter
    compile rootProject.ext.glide
    compile rootProject.ext.cardview
    compile rootProject.ext.butterknife
    compile rootProject.ext.multidex
    //apt rootProject.ext.butterknifeCompiler
    annotationProcessor rootProject.ext.butterknifeCompiler
    compile (rootProject.ext.photoview) {
        exclude module: 'support-v4'
    }
    compile 'com.umeng.analytics:analytics:latest.integration'
}

修改后:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation rootProject.ext.appcompatV7
    implementation rootProject.ext.supportV4
    implementation rootProject.ext.androiddesign
    implementation rootProject.ext.recyclerview
    implementation (rootProject.ext.realm){
       exclude group: 'org.ow2.asm', module: 'asm'
        exclude group: 'org.ow2.asm', module: 'asm-commons'
        exclude group: 'org.ow2.asm', module: 'asm-tree'
        exclude group: 'org.ow2.asm', module: 'asm-analysis'
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-runtime'
    }
    implementation rootProject.ext.retrofit
    implementation rootProject.ext.retrofitgson
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxAdapter
    implementation rootProject.ext.glide
    implementation rootProject.ext.cardview
    implementation rootProject.ext.butterknife
    implementation rootProject.ext.multidex
    //apt rootProject.ext.butterknifeCompiler
    annotationProcessor rootProject.ext.butterknifeCompiler
    implementation (rootProject.ext.photoview) {
        exclude module: 'support-v4'
    }
    implementation 'com.umeng.analytics:analytics:latest.integration'
}

然而这个Error仍然存在,网上搜索良久无果,今天突然灵光一闪,是不是跟realm版本还是有关系,于是注释掉realm相关验证一下:
第一个注释:

 //apply plugin: 'realm-android'

第二个注释:

//classpath "io.realm:realm-gradle-plugin:2.2.0"

果然Error消失了,但是我们仍然需要使用realm怎么办,那就升级realm版本吧,通过官网找一下最新版本:

https://realm.io/docs/java/latest
2019.09.14 Realm Lastest版本:5.15.1
还原前面两个注释,修改如下:

classpath "io.realm:realm-gradle-plugin:5.15.1"

好了,问题解决!

另外在搜索过程中还有人发现google-services的版本也会导致上述问题,同样可以升级到最新版本来解决,比如(这里的3.2.0不是google-services的最新版本):

classpath 'com.google.gms:google-services:3.2.0'
这种解决问题的思路,希望对你有帮助!

—————————————————————结束分割线—————————————————————-

今天的文章编译和运行的区别_python打包成安卓app[通俗易懂]分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/86783.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注