Failed to instantiate application in jetpack compose - android

So i'am trying to learn Jetpack Compose, but my Dependency Injection with dagger hilt cannot work properly. But, it is works fine in the other project, so is there something i'am missing here?
FATAL EXCEPTION: main
Process: com.lelestacia.submissioncompose, PID: 6340
java.lang.RuntimeException: Unable to instantiate application com.lelestacia.submissioncompose.application.MyApp package com.lelestacia.submissioncompose: java.lang.ClassNotFoundException: Didn't find class "com.lelestacia.submissioncompose.application.MyApp" on path: DexPathList[[dex file "/data/data/com.lelestacia.submissioncompose/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/base.apk"],nativeLibraryDirectories=[/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1466)
at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1395)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6746)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.lelestacia.submissioncompose.application.MyApp" on path: DexPathList[[dex file "/data/data/com.lelestacia.submissioncompose/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/base.apk"],nativeLibraryDirectories=[/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:52)
at android.app.Instrumentation.newApplication(Instrumentation.java:1232)
at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1458)
at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1395) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6746) 
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:201) 
at android.os.Looper.loop(Looper.java:288) 
at android.app.ActivityThread.main(ActivityThread.java:7898) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/lelestacia/submissioncompose/application/Hilt_MyApp;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 16 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.lelestacia.submissioncompose.application.Hilt_MyApp" on path: DexPathList[[dex file "/data/data/com.lelestacia.submissioncompose/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/base.apk"],nativeLibraryDirectories=[/data/app/~~UPDLbuW7-1MIDHePtZAPuw==/com.lelestacia.submissioncompose-VtqvuByd7B1W6Uwl4SYgJA==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 19 more
And java generated also didn't generate my viewmodel factory, and my app module still marked as unused function even tho it has the icon of consumed from dagger hilt.

Related

I'm having issues with my mainActivity when i run my flutter app

Heyy there
When i try running my flutter app on andriod is give me the flollowing error on my termninal
E/AndroidRuntime(10355): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.robyhub.admin/com.robyhub.admin.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551) E/AndroidRuntime(10355): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782) E/AndroidRuntime(10355): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) E/AndroidRuntime(10355): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(10355): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(10355): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) E/AndroidRuntime(10355): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(10355): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(10355): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(10355): at android.app.ActivityThread.main(ActivityThread.java:7872) E/AndroidRuntime(10355): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10355): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(10355): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) E/AndroidRuntime(10355): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10355): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/AndroidRuntime(10355): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime(10355): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(10355): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95) E/AndroidRuntime(10355): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45) E/AndroidRuntime(10355): at android.app.Instrumentation.newActivity(Instrumentation.java:1339) E/AndroidRuntime(10355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538) E/AndroidRuntime(10355): ... 12 more E/AndroidRuntime(10460): FATAL EXCEPTION: main E/AndroidRuntime(10460): Process: com.robyhub.admin, PID: 10460 E/AndroidRuntime(10460): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.robyhub.admin/com.robyhub.admin.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551) E/AndroidRuntime(10460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782) E/AndroidRuntime(10460): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) E/AndroidRuntime(10460): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(10460): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(10460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) E/AndroidRuntime(10460): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(10460): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(10460): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(10460): at android.app.ActivityThread.main(ActivityThread.java:7872) E/AndroidRuntime(10460): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10460): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(10460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) E/AndroidRuntime(10460): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10460): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/AndroidRuntime(10460): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime(10460): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(10460): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95) E/AndroidRuntime(10460): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45) E/AndroidRuntime(10460): at android.app.Instrumentation.newActivity(Instrumentation.java:1339) E/AndroidRuntime(10460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538) E/AndroidRuntime(10460): ... 12 more
I have tried flutter clean and flutter build but no luck so far.
Please what can i do?
It appears that Flutter is unable to find the main activity of your app. This could be due to a number of issues, including a misconfigured manifest or the main activity not being declared correctly in the manifest.
It is also possible that you have an issue with your build configuration. Check your build.gradle file and make sure that the main activity is correctly declared as the launcher activity.
You should also check the AndroidManifest.xml file to make sure that the main activity is correctly declared there. If everything looks correct but the issue persists, you may need to perform a flutter clean to clear any cached build files.
If you are still having issues, you may want to try running the app in an emulator or on a different device to determine if the issue is isolated to a particular device. It is also possible that the issue is caused by a bug in the version of Flutter you are using. If this is the case, you may need to upgrade to a newer version of Flutter.

Firebird and Android JDBC Driver

have problem with Firebird. I have never work with DB. DB on server firebird 1.5.
Add lib: firebird-full-2.2.4 to libs folder
Add this to Gradle: implementation fileTree('libs')
Add this to MainActivity:
Class.forName("org.firebirdsql.jdbc.FBDriver")
val connection = DriverManager.getConnection(
"jdbc:firebirdsql://jdbc:firebirdsql:193.###.###.13/3050:Scool",
"###", "###")
connection.close()
After start I have this:
E/AndroidRuntime: FATAL
EXCEPTION: main
Process: success.kneu, PID: 12219
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/resource/Referenceable;
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48)
at android.view.View.performClick(View.java:5647)
at android.view.View$PerformClick.run(View.java:22465)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6238)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: javax.resource.Referenceable
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:400) 
at java.lang.Class.forName(Class.java:326) 
at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48) 
at android.view.View.performClick(View.java:5647) 
at android.view.View$PerformClick.run(View.java:22465) 
at android.os.Handler.handleCallback(Handler.java:754) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6238) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/Referenceable;
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:400) 
at java.lang.Class.forName(Class.java:326) 
at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48) 
at android.view.View.performClick(View.java:5647) 
at android.view.View$PerformClick.run(View.java:22465) 
at android.os.Handler.handleCallback(Handler.java:754) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6238) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.Referenceable" on path: DexPathList[[zip file
"/data/app/success.kneu-1/base.apk", zip file
"/data/app/success.kneu-1/split_lib_dependencies_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_0_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_1_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_2_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_3_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_4_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_5_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_6_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_7_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_8_apk.apk", zip file
"/data/app/success.kneu-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/success.kneu-1/lib/arm64,
/system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:400) 
at java.lang.Class.forName(Class.java:326) 
at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48) 
at android.view.View.performClick(View.java:5647) 
at android.view.View$PerformClick.run(View.java:22465) 
at android.os.Handler.handleCallback(Handler.java:754) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6238) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 
2019-07-14 17:37:03.815 12219-12219/? I/Process: Sending signal. PID:
12219 SIG: 9
Jaybird, the Firebird JDBC driver, does not work on Android. There is an Android port of Jaybird, but it is not maintained by the Jaybird team.
The error itself indicates a problem with loading the connector-api because of missing JNDI classes like javax.naming.Referenceable in Android. This would indicate that you are trying to use the normal Jaybird and not the Android port of Jaybird.
Try and replace your Jaybird dependency with one from the Android port.
Be aware though that in general you should not use JDBC drivers to connect to a database from Android. See also JDBC vs Web Service for Android.

java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.CoreComponentFactory"

it's a release apk, and not always to carsh.
happens when i use the firebase to start app in Android P.
it's high rate when first to install the app.
here is the log:
2019-06-13 13:28:08.565 23255-23255/? E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.CoreComponentFactory" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.trackerandroid.trackerandroid-aZ7PnMXyzCxnkBL3b5t3Vg==/base.apk"],nativeLibraryDirectories=[/data/app/com.trackerandroid.trackerandroid-aZ7PnMXyzCxnkBL3b5t3Vg==/lib/arm, /data/app/com.trackerandroid.trackerandroid-aZ7PnMXyzCxnkBL3b5t3Vg==/base.apk!/lib/armeabi-v7a, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:239)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:768)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:847)
at android.app.LoadedApk.getResources(LoadedApk.java:1088)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6108)
at android.app.ActivityThread.access$1200(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1792)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7058)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Check AndroidManifest file and check application section "android.support.v4.app.CoreComponentFactory", if it is written delete it.

FATAL EXCEPTION: java.lang.ClassNotFoundException: Didn't find class "MainAcitivity" on path: DexPathList

I have searched extensively to find a solution for this issue and tried what I see has been suggested in the past.
Things I tried:
Deleted *.iml files locally
Deleted .idea files locally
Removed the project
Closed Android Studio and re-imported
Invalidated cached
Cleaned and re-builded.
I'm assuming what caused the problem is moving MainActivity to a newly created package. Any suggestions would be greatly appreciated.
2019-02-23 17:04:15.948 5842-5842/com.ssowens.android.myweatherapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ssowens.android.myweatherapp, PID: 5842
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ssowens.android.myweatherapp/com.ssowens.android.myweatherapp.ui.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.ssowens.android.myweatherapp.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/base.apk"],nativeLibraryDirectories=[/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ssowens.android.myweatherapp.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/base.apk"],nativeLibraryDirectories=[/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

DJI SDK 4.7.1 crashes unceremoneously where 4.6 does not

I'm trying to update my app to use the new 4.7.1 version, but as soon as I try to go to the activity where I'm using UXSDK Widgets, the app now crashes without additional log entries. After updating the SDK version, I made sure that my build.gradle, AndroidManifest.xml and proguard-rules.pro matched up in the relevant areas from the sample code at https://github.com/dji-sdk/Mobile-SDK-Android.
I noticed that across both versions of the SDK I receive very similar logcat errors:
E/DJISDKManager: can't find DJIEventBusIndex Class in SharedLib module
E/DJISDKManager: java.lang.ClassNotFoundException: dji.event3.sharelib.DJIEventBusIndex
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:43)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.event3.sharelib.DJIEventBusIndex" on path: DexPathList[[zip file "/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk", zip file "/data/user/0/com.reportall.droneglide.fence/.cache_sdk/sdkclasses.jar"],nativeLibraryDirectories=[/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/lib/arm64, /data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at java.lang.Class.forName(Class.java:378) 
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:43) 
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0) 
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95) 
at java.lang.Thread.run(Thread.java:764) 
E/DJISDKManager: can't find DJIEventBusIndex Class in MidWare module
E/DJISDKManager: java.lang.ClassNotFoundException: dji.event3.midware.DJIEventBusIndex
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:62)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.event3.midware.DJIEventBusIndex" on path: DexPathList[[zip file "/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk", zip file "/data/user/0/com.reportall.droneglide.fence/.cache_sdk/sdkclasses.jar"],nativeLibraryDirectories=[/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/lib/arm64, /data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at java.lang.Class.forName(Class.java:378) 
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:62) 
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0) 
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95) 
at java.lang.Thread.run(Thread.java:764) 
E/DJISDKManager: can't find DJIEventBusIndex Class in FlyForbid module
E/DJISDKManager: java.lang.ClassNotFoundException: dji.event3.flyforbid.DJIEventBusIndex
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:81)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.event3.flyforbid.DJIEventBusIndex" on path: DexPathList[[zip file "/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk", zip file "/data/user/0/com.reportall.droneglide.fence/.cache_sdk/sdkclasses.jar"],nativeLibraryDirectories=[/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/lib/arm64, /data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at java.lang.Class.forName(Class.java:378) 
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:81) 
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0) 
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95) 
at java.lang.Thread.run(Thread.java:764) 
E/DJISDKManager: can't find DJIEventBusIndex Class in service module
E/DJISDKManager: java.lang.ClassNotFoundException: dji.event3.service.DJIEventBusIndex
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:100)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.event3.service.DJIEventBusIndex" on path: DexPathList[[zip file "/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk", zip file "/data/user/0/com.reportall.droneglide.fence/.cache_sdk/sdkclasses.jar"],nativeLibraryDirectories=[/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/lib/arm64, /data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at java.lang.Class.forName(Class.java:378) 
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:100) 
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0) 
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95) 
at java.lang.Thread.run(Thread.java:764) 
can't find DJIEventBusIndex Class in FrLib module
E/DJISDKManager: java.lang.ClassNotFoundException: com.dji.frlib.DJIEventBusIndex
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:119)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.dji.frlib.DJIEventBusIndex" on path: DexPathList[[zip file "/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk", zip file "/data/user/0/com.reportall.droneglide.fence/.cache_sdk/sdkclasses.jar"],nativeLibraryDirectories=[/data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/lib/arm64, /data/app/com.reportall.droneglide.fence-OGmqnjtacp7079L76urIHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at java.lang.Class.forName(Class.java:378) 
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:119) 
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0) 
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95) 
at java.lang.Thread.run(Thread.java:764)
In 4.7.1, there is an additional preceding message that comes immediately before the above block:
E/DJISDKManager: Failed to load license file /storage/emulated/0/DJI/license.dlf (No such file or directory)
Which I assume must have something to do with a new storage mechanism of the license. Later I get:
W/System.err: java.util.concurrent.TimeoutException
at dji.midware.util.t.a(Unknown Source:40)
at dji.midware.broadcastReceivers.DJINetWorkReceiver.b(Unknown Source:30)
W/System.err: at dji.midware.broadcastReceivers.DJINetWorkReceiver.f(Unknown Source:88)
at dji.midware.broadcastReceivers.DJINetWorkReceiver.<init>(Unknown Source:10)
at dji.sdk.sdkmanager.DJISDKManager.initParams(Unknown Source:189)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:146)
at dji.sdk.sdkmanager.DJISDKManager.access$1100(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:95)
at java.lang.Thread.run(Thread.java:764)
Despite these errors, in both versions of the SDK, my logs return Returned from registerApp, we got: API Key successfully registered but in 4.7.1 the app simply crashes when I try to access the UXSDK elements after. I do grant storage permissions to the app, so I don't know why it's failing with that license file either.
For reference, my build.gradle lists the following relevant block for the SDK:
// DJI SDK
implementation 'com.dji:dji-sdk:4.7.1'
implementation 'com.dji:dji-uxsdk:4.7.1'
compileOnly 'com.dji:dji-sdk-provided:4.7.1'
implementation 'com.squareup:otto:1.3.8'
UPDATE: I attached an Exception handler to the class where the crash happens so I can get a real stack trace. The actual app crash is caused by:
E/ExceptionHandler: java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
at dji.thirdparty.rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: dji.thirdparty.rx.exceptions.OnErrorNotImplementedException: Attempt to invoke virtual method 'void dji.ux.model.c.b(java.lang.String)' on a null object reference
at dji.thirdparty.rx.Observable$26.onError(Observable.java:8524)
at dji.thirdparty.rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
at dji.thirdparty.rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
at dji.thirdparty.rx.observers.SerializedObserver.onError(SerializedObserver.java:158)
at dji.thirdparty.rx.observers.SerializedSubscriber.onError(SerializedSubscriber.java:79)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerError(OnSubscribeConcatMap.java:192)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerSubscriber.onError(OnSubscribeConcatMap.java:340)
at dji.thirdparty.rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264)
at dji.thirdparty.rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207)
at dji.thirdparty.rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:790) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void dji.ux.model.c.b(java.lang.String)' on a null object reference
at dji.ux.panel.PreFlightCheckListPanel.addItemsOnDisconnect(Unknown Source:152)
at dji.ux.panel.PreFlightCheckListPanel.transformValue(Unknown Source:245)
at dji.ux.base.SimpleFrameLayoutWidget$1.a(Unknown Source:6)
at dji.ux.base.SimpleFrameLayoutWidget$1.call(Unknown Source:2)
at dji.thirdparty.rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:223)
at dji.thirdparty.rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:220)
at dji.thirdparty.rx.Observable$2.call(Observable.java:233)
at dji.thirdparty.rx.Observable$2.call(Observable.java:225)
at dji.thirdparty.rx.Observable.unsafeSubscribe(Observable.java:8741)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
at dji.thirdparty.rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.slowPath(OnSubscribeFromArray.java:100)
at dji.thirdparty.rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.request(OnSubscribeFromArray.java:63)
at dji.thirdparty.rx.Subscriber.setProducer(Subscriber.java:211)
at dji.thirdparty.rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:32)
at dji.thirdparty.rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:24)
at dji.thirdparty.rx.Observable.unsafeSubscribe(Observable.java:8741)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
at dji.thirdparty.rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
at dji.thirdparty.rx.Observable.subscribe(Observable.java:8834)
at dji.thirdparty.rx.Observable.subscribe(Observable.java:8801)
at dji.thirdparty.rx.Observable.subscribe(Observable.java:8515)
at dji.ux.c.h$3$1.onSuccess(Unknown Source:34)
at dji.keysdk.KeyManager$1.onSuccess(Unknown Source:14)
at dji.sdksharedlib.DJISDKCache.getValue(Unknown Source:14)
at dji.keysdk.KeyManager.getValue(Unknown Source:18)
at dji.ux.c.h$3.a
I ended up fixing this issue by copying over the contents of the example widget layout.xml (activity_default_widgets.xml) file. The only changes I noticed outside of element ordering between the two versions was:
-custom:excludeItem="aircraftBatteryTemperature|ESCStatus"
+custom:excludeItem="ESCStatus"
and in a couple of places:
-android:visibility="invisible"
+android:visibility="gone"
I have no idea why these changes would have crashed the app with the stack trace from my question update, but only changing this XML file allowed the activity to load again.
Change
implementation 'com.dji:dji-sdk:4.7.1'
implementation 'com.dji:dji-uxsdk:4.7.1'
compileOnly 'com.dji:dji-sdk-provided:4.7.1'
implementation 'com.squareup:otto:1.3.8'
to
implementation 'com.dji:dji-uxsdk:4.7.1'
compileOnly 'com.dji:dji-sdk-provided:4.7.1'
implementation 'com.squareup:otto:1.3.8'
The UXSDK depends on SDK and hence the SDK need not be included. Hope that helps!

Categories

Resources