0

これはしばらくの間、私にとって問題でした。最新の Android Studio バージョンで導入された APK 分割機能に関連していると思います。

05-22 09:22:21.274 3451-3451/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: android.zeroarst.lab.sharedelement, PID: 3451
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.zeroarst.lab.sharedelement/android.zeroarst.lab.sharedelement.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "android.zeroarst.lab.sharedelement.MainActivity" on path: DexPathList[[zip file "/data/app/android.zeroarst.lab.sharedelement-2/base.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_dependencies_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_0_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_1_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_2_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_3_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_4_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_5_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_6_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_7_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_8_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/android.zeroarst.lab.sharedelement-2/lib/x86_64, /system/lib64, /vendor/lib64]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6119)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

他にもありますが、それらはすべて同じ例外です。

インスタントランを無効にすると、すべて問題ありません。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "android.zeroarst.lab.sharedelement"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:multidex:1.0.1'

    testCompile 'junit:junit:4.12'
}
4

0 に答える 0