세상사는 이야기 / 도움이 되었다면 배너 클릭 부탁드려요~ →→→

2019년 7월 23일 화요일

[Unity Android] java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication

[Unity Android] java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication"

1. Android Resolver 1.2.122
2. MultiDex 사용

Android Resolver 1.2.122로 버전을 올리니 mainTemplate.gradle파일에 UseAndroidX가 true로 되어있어서 기존에 사용하던 android.support를 사용할 수 없게 되었다.
AndroidX : 기존 Android 지원 라이브러리를 개선하여 만들었다고 한다.

Plugins/Android/mainTemplate.gradle
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
    ext {
        it.setProperty("android.useAndroidX", true)
        it.setProperty("android.enableJetifier", true)
    }
}

AndroidManifest파일에 android.support를 androidx로 바꾸어주면된다.

Plugins/Android/AndroidManifest.xml
<application ....
android:name="android.support.multidex.MultiDexApplication"
->
android:name="androidx.multidex.MultiDexApplication"

참고
https://forum.unity.com/threads/gradle-3-2-0-crashes-app-on-launch.712970/

에러전문

07-12 09:44:25.528: E/AndroidRuntime(3272): FATAL EXCEPTION: main
07-12 09:44:25.528: E/AndroidRuntime(3272): Process: com.kor.mf, PID: 3272
07-12 09:44:25.528: E/AndroidRuntime(3272): java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.kor.mf-1/base.apk"],nativeLibraryDirectories=[/data/app/com.kor.mf-1/lib/arm, /vendor/lib, /system/lib]]
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.ActivityThread.access$1500(ActivityThread.java:151)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.os.Handler.dispatchMessage(Handler.java:102)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.os.Looper.loop(Looper.java:135)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.ActivityThread.main(ActivityThread.java:5254)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.reflect.Method.invoke(Native Method)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.reflect.Method.invoke(Method.java:372)
07-12 09:44:25.528: E/AndroidRuntime(3272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
07-12 09:44:25.528: E/AndroidRuntime(3272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
07-12 09:44:25.528: E/AndroidRuntime(3272): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.kor.mf-1/base.apk"],nativeLibraryDirectories=[/data/app/com.kor.mf-1/lib/arm, /vendor/lib, /system/lib]]
07-12 09:44:25.528: E/AndroidRuntime(3272): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.Instrumentation.newApplication(Instrumentation.java:980)
07-12 09:44:25.528: E/AndroidRuntime(3272): at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
07-12 09:44:25.528: E/AndroidRuntime(3272): ... 10 more
07-12 09:44:25.528: E/AndroidRuntime(3272): Suppressed: java.lang.ClassNotFoundException: android.support.multidex.MultiDexApplication
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.Class.classForName(Native Method)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
07-12 09:44:25.528: E/AndroidRuntime(3272): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
07-12 09:44:25.528: E/AndroidRuntime(3272): ... 13 more
07-12 09:44:25.528: E/AndroidRuntime(3272): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

댓글 없음:

댓글 쓰기