Android转androidx

Android Studio需要升级3.2或更高版本
compileSdkVersion的版本升级到28及以上
buildToolsVersion的版本升级到28.0.2及以上
Gradle 插件版本改为 4.6及以上

工程build.gradle
classpath 'com.android.tools.build:gradle:3.4.1'
gradle-wrapper.properties中
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-

all.zipandroid.useAndroidX=true
android.enableJetifier=true

报错及处理

Manifest merger failed with multiple errors, see logs

根据错误工程及执行的内容  使用Gradle 执行对应task出现详细修改位置

根据提示添加
android:supportsRtl="true"
tools:replace="android:allowBackup,android:supportsRtl"

编译错误提示

Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.getBootClasspath()Ljava/lang/String;'
org.gradle.api.tasks.compile.CompileOptions.getBootClasspath()Ljava/lang/String;

有出现位置 执行Gradle 找到出问题工程(刚开始以为是gradle版本和路径问题,费了好大劲)

Gradle may disable incremental compilation as the following annotation processors are not incremental: lombok-1.16.18.jar (org.projectlombok:lombok:1.16.18), databinding-compiler-3.4.1.jar (androidx.databinding:databinding-compiler:3.4.1).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.

修改方案

annotationProcessor "org.projectlombok:lombok:1.16.18"
compileOnly 'org.projectlombok:lombok:1.16.18'

修改为 

annotationProcessor "org.projectlombok:lombok:1.18.20"
compileOnly 'org.projectlombok:lombok:1.18.20'

 项目中build.gradle 屏蔽 apply plugin: 'me.tatarka.retrolambda'

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'kotlin-android-extensions'
引用工程中 下面这个删除
<uses-sdk
    android:minSdkVersion="9" />

core_lib 中 build.gradle修改

//apply plugin: 'me.tatarka.retrolambda'
dataBinding {
    enabled = true
}
   annotationProcessor "org.projectlombok:lombok:1.18.20"
    compileOnly 'org.projectlombok:lombok:1.18.20'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'

widget_lib build.gradle 修改

//apply plugin: 'me.tatarka.retrolambda'  
compileOnly('org.greenrobot:eventbus:3.0.0') {
        exclude module: 'support-compat'
    }

bunnydaemon 中 build.gradle 修改

//apply plugin: 'me.tatarka.retrolambda'

compileSdkVersion 28
    buildToolsVersion '28.0.2'

targetSdkVersion 28

   dataBinding {
        enabled = true
    }

dependencies {
    implementation project(path: ':verticalviewpage')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    provided fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':core_lib')
    provided files('libs/classes1.jar')
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'
    implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
    implementation 'com.google.android.gms:play-services:11.0.4'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    //compile 'com.android.support:support-v4:25.3.1'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
    implementation 'javax.annotation:javax.annotation-api:1.2'
    annotationProcessor "org.projectlombok:lombok:1.18.20"
    compileOnly 'org.projectlombok:lombok:1.18.20'
    implementation 'zlc.season:rxdownload2:2.0.2'
    provided project(path: ':compiler-api')
    annotationProcessor project(path: ':compiler')
    implementation 'com.tencent.bugly:crashreport:latest.release'
    implementation 'com.tencent.bugly:nativecrashreport:3.0'
    implementation project(':library')
    testCompile 'junit:junit:4.12'
    compileOnly files('libs/classes.jar')
    compile 'androidx.cardview:cardview:1.0.0'
}

剩下编译代码,哪出问题,手动修改  Android应用改androidx 

bunnydaemon viewpager 自定义引用(拷贝)

canvas.save(Canvas.ALL_SAVE_FLAG);

修改为

canvas.save();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值