1、在Android app.gradle中
buildFeatures{
// viewBinding=true
dataBinding=true
}
2、在mannifest中添加
tools:replace=“android:allowBackup”
android:allowBackup=“true”
3、在project.gradle中替换
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = “1.4.32”
repositories {
google()
jcenter()
maven {
url “http://maven.aliyun.com/nexus/content/repositories/releases/”
}
maven {
url “http://maven.aliyun.com/nexus/content/repositories/snapshots”
}
}
dependencies {
classpath “com.android.tools.build:gradle:4.1.2”
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
classpath ‘cn.leo.plugin:magic-plugin:1.0.0’
classpath ‘com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.6’
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url ‘https://jitpack.io’ }
maven {
url “http://maven.aliyun.com/nexus/content/repositories/releases/”
}
maven {
url “http://maven.aliyun.com/nexus/content/repositories/snapshots”
}
maven {
url “http://maven.aliyun.com/nexus/content/repositories/releases/”
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
4、需要对编译版本降级
compileSdkVersion 28
5、在app.gradle中添加依赖
在defaultConfig中添加
multiDexEnabled true
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.aliyun.alink.linksdk:iot-linkkit:1.6.6'
implementation 'com.blankj:utilcode:1.25.9'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.github.jarryleo:MagicScreenAdapter:v2.8'
implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
implementation 'org.projectlombok:lombok:1.16.8'
def lifecycle_version ="2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
implementation ('com.github.bumptech.glide:glide:4.7.1'){
exclude group:"com.android.support"
}
implementation 'com.google.code.gson:gson:2.8.5'
implementation("com.squareup.okhttp3:okhttp:4.8.1")
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
implementation 'com.tencent:mmkv:1.0.10'