Kotlin 开发错误集合

1.ERROR: Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

方案1-修改配置后执行编译

compileSdkVersion, buildToolsVersion, targetSdkVersion从31改成30

 方案二

打开build-tools\31.0.0

d8.bat的文件,这是批处理文件,重命名d8.bat为dx.bat

打开build-tools\31.0.0\lib

将d8.jar重命名为dx.jar

2. AAPT: error: resource string/appbar_scrolling_view_behavior

AAPT: error: attribute defaultNavHost

AAPT: error: attribute layout_constraintBottom_toBottomOf

AAPT: error: attribute layout_constraintLeft_toLeftOf

AAPT: error: attribute layout_constraintRight_toRightOf

解决方案

build.gradle里面添加依赖 / 然后重新加载依赖

implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
dependencies {
    .......
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
}

 3.AVD New_Device is already running

 解决方案:

删除.android/avd/New_Device_4_API_29.avd/目录下面所有以.lock结尾的文件

 

java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)

解决方案

gradle.properties 文件下添加如下配置

:app:kaptDebugKotlin

java.lang.reflect.InvocationTargetException (no error message)

 解决方案

gradle.properties 文件下添加如下配置

kapt.incremental.apt = false
kapt.include.compile.classpath=false
kapt.use.worker.api=false

 


版权声明:本文为u013491829原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。