Unable to instantiate activity ComponentInfo{xxxActivity}: java.lang.ClassNotFoundException

启动 APP 包如下这个错误

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{xxxActivity}: java.lang.ClassNotFoundException: Didn’t find class “xxxActivity” on path: DexPathList[[zip file “/data/app/xxxxp24tPO4BIuLT9rY0tDKb8A==/base.apk”],nativeLibraryDirectories=[/data/app/xxxx-p24tPO4BIuLT9rY0tDKb8A==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]

解决方法

android {
     
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
     
    }

    compileOptions {
     
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

需要 Java8 的支持!

你可能感兴趣的:(Android,开发问题,Java8,Android,gradle)