1.ext.kotlin_version升級(jí) / repositories 里新增
gradle升級(jí)后
ext.kotlin_version會(huì)提示升級(jí)到對應(yīng)版本:
ext.kotlin_version = '1.1.51'
ext.kotlin_version = '1.3.10'kotlin引入的庫修改 (jre7 / jdk7):
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- repositories 里新增:
mavenCentral()

2.gradle.properties去掉 android.enableAapt2=false
升級(jí)到3.4.0后如果里面有android.enableAapt2=false會(huì)報(bào)錯(cuò),去掉即可
3.所有依賴庫里去掉 buildToolsVersion
這個(gè)會(huì)提示錯(cuò)誤:buildToolsVersion rootProject.ext.buildToolsVersion,一鍵就可以去掉
4.引入名稱修正
| 3.0.1 | 3.4.0 |
|---|---|
| testCompile | testImplementation |
| androidTestCompile | androidTestImplementation |
| compile | api / implementation |
| instrumentTest | androidTest |
api / implementation:
表示此庫引入的jar包也是否可以被 引入此庫的項(xiàng)目使用(例如A引入B,B引入了C,如果B引入C時(shí) 使用api則A也可以使用C,如果使用implementation則A不能使用C)。
注意這樣的形式: api fileTree(dir: 'libs', include: ['*.jar'])
5.<item> inner element must either be a resource reference or empty
錯(cuò)誤<item>內(nèi)部元素必須是資源引用或空
如果是自己的庫中出現(xiàn)的情況:
<item name="webviewload_monitor_cancel_point" type="id"/>
如果是三方文件引入,則不能直接修改文件。可以借助gradle中的resValue這個(gè)方法去修改編譯中的文件:
android {
...
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "id", "webviewload_monitor_cancel_point",""
}
debug{
resValue "id", "webviewload_monitor_cancel_point",""
}
...
}