Mobile-SDK-Android-V5 icon indicating copy to clipboard operation
Mobile-SDK-Android-V5 copied to clipboard

ClassNotFoundException Didn't find class "dji.v5.manager.interfaces.SDKManagerCallback" on path

Open bdlilley opened this issue 3 months ago • 2 comments

Problem

I am trying to create a bare-bones app that imports the DJI msdk v5.15.0, but regardless of adjusting many settings, I always get Failed resolution of: Ldji/v5/manager/interfaces/SDKManagerCallback in the runtime.

Here is my current android project repo: https://github.com/bdlilley/seabase

Logcat logs from trying to run on a tablet (version details below):

---------------------------- PROCESS STARTED (28759) for package com.bdlilley.seabase ----------------------------
2025-08-25 11:55:45.814 28759-28759 ziparchive              com.bdlilley.seabase                 W  Unable to open '/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.dm': No such file or directory
2025-08-25 11:55:45.814 28759-28759 ziparchive              com.bdlilley.seabase                 W  Unable to open '/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.dm': No such file or directory
2025-08-25 11:55:46.039 28759-28759 nativeloader            com.bdlilley.seabase                 D  Configuring clns-7 for other apk /data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk. target_sdk_version=36, uses_libraries=, library_path=/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/lib/arm64:/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.bdlilley.seabase
2025-08-25 11:55:46.051 28759-28759 GraphicsEnvironment     com.bdlilley.seabase                 V  Currently set values for:
2025-08-25 11:55:46.051 28759-28759 GraphicsEnvironment     com.bdlilley.seabase                 V    angle_gl_driver_selection_pkgs=[]
2025-08-25 11:55:46.051 28759-28759 GraphicsEnvironment     com.bdlilley.seabase                 V    angle_gl_driver_selection_values=[]
2025-08-25 11:55:46.051 28759-28759 GraphicsEnvironment     com.bdlilley.seabase                 V  Global.Settings values are invalid: number of packages: 0, number of values: 0
2025-08-25 11:55:46.051 28759-28759 GraphicsEnvironment     com.bdlilley.seabase                 V  Neither updatable production driver nor prerelease driver is supported.
2025-08-25 11:55:46.148 28759-28759 nativeloader            com.bdlilley.seabase                 D  Load /data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk!/lib/arm64-v8a/libSdkyclx_clx.so using ns clns-7 from class loader (caller=/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk): ok
2025-08-25 11:55:46.168 28759-28759 dlilley.seabase         com.bdlilley.seabase                 E  No implementation found for void com.cySdkyc.clx.Helper.i() (tried Java_com_cySdkyc_clx_Helper_i and Java_com_cySdkyc_clx_Helper_i__) - is the library loaded, e.g. System.loadLibrary?
2025-08-25 11:55:46.200 28759-28759 AndroidRuntime          com.bdlilley.seabase                 D  Shutting down VM
2025-08-25 11:55:46.202 28759-28759 AndroidRuntime          com.bdlilley.seabase                 E  FATAL EXCEPTION: main (Ask Gemini)
                                                                                                    Process: com.bdlilley.seabase, PID: 28759
                                                                                                    java.lang.NoClassDefFoundError: Failed resolution of: Ldji/v5/manager/interfaces/SDKManagerCallback;
                                                                                                    	at java.lang.Class.newInstance(Native Method)
                                                                                                    	at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
                                                                                                    	at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:51)
                                                                                                    	at android.app.Instrumentation.newApplication(Instrumentation.java:1352)
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1525)
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1457)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:8316)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2675)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:257)
                                                                                                    	at android.os.Looper.loop(Looper.java:342)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:9634)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.v5.manager.interfaces.SDKManagerCallback" on path: DexPathList[[zip file "/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk"],nativeLibraryDirectories=[/data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/lib/arm64, /data/app/~~YCOkIwHaW2j-FgPS725qbw==/com.bdlilley.seabase-QvWVWoT7r2gtU3X_mY8vmw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                    	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
                                                                                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
                                                                                                    	at java.lang.Class.newInstance(Native Method) 
                                                                                                    	at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76) 
                                                                                                    	at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:51) 
                                                                                                    	at android.app.Instrumentation.newApplication(Instrumentation.java:1352) 
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1525) 
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1457) 
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:8316) 
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2675) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:257) 
                                                                                                    	at android.os.Looper.loop(Looper.java:342) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:9634) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929) 
2025-08-25 11:55:46.233 28759-28759 Process                 com.bdlilley.seabase                 I  Sending signal. PID: 28759 SIG: 9
---------------------------- PROCESS ENDED (28759) for package com.bdlilley.seabase ----------------------------

Versions

  • Host: macbook pro M4 max running Sequoia 15.5
  • Android studio: Android Studio Narwhal Feature Drop | 2025.1.2 Patch 1
  • Target device: Samsung Galaxy Tab A9 running Android version 15, kernel 5.10.218-android12-9-30958166

Things I've Tried

  • Followed all instructions in https://developer.dji.com/doc/mobile-sdk-tutorial/en/quick-start/user-project-caution.html#edit-the-androidmanifest-xml-file
    • I have tried each step word-for-word and end up with the same failures
    • I realize my linked repo is a little different than the docs steps - but I have tried them all with the same results
  • Tried the "empty project with MSDK integrated" from the links in that doc - https://terra-1-g.djicdn.com/fee90c2e03e04e8da67ea6f56365fc76/SDK%20%E6%96%87%E6%A1%A3/MSDK/5.11.0/SDKSample.zip - I get the same results with this project as I do the one I linked in github
  • Tried all suggestions from claude code and chatgpt - these mostly revolved around modifying proguard rules and changing multidex configurations to force the correct classes into the apk
  • apk analysis
    • I found that SDKManager does exist in the APK in classes3.dex but with a size of 8b

Any help in getting this to build, deploy, and load the DJI sdk would be greatly appreciated!

bdlilley avatar Aug 25 '25 16:08 bdlilley

Agent comment from YIGUI LIU in Zendesk ticket #154404:

Dear Developer,

It is recommended that you first run the MSDK Sample App successfully to facilitate subsequent comparison and verification of issues.

  • Run Sample Code: https://developer.dji.com/doc/mobile-sdk-tutorial/en/quick-start/run-sample.html

Then, based on the error log you provided, it is found that the main issue is the failure to find the class: dji.v5.manager.interfaces.SDKManagerCallback. It is recommended that you troubleshoot the problem through the following points:

  1. Version configuration of the development environment The version configuration of the development environment needs to be consistent with that of the MSDK v5.15.0 Sample Code:
  • Java Runtime: 17
  • Kotlin: 1.8.10
  • Gradle: 7.6.2
  • Android Gradle Plugin: 7.4.2
  • minSdkVersion: 24
  • targetSdkVersion: 34
  • NDK_VERSION = 21.4.7075529
  1. Error with com.cySdkyc.clx.Helper.install(this); On the "Run/Debug Configurations" page of Android Studio, check the "Always install with package manager" option. Failure to do so will result in the installation failure of com.cySdkyc.clx.Helper.install(this).
  2. SDKManager error: Failed to find the class dji.v5.manager.interfaces.SDKManagerCallback at runtime
  3. Check whether the SDK dependency is correctly imported.
  4. Refer to the SDK Sample and check if com.cySdkyc.clx.Helper.install(this) is called in the Application class. Do not call any MSDK-related interfaces before invoking this method.
  5. Switch the execution of SDKManager.getInstance().init() to an Activity or to the main thread.

Best Regards, DJI Innovations SDK Technical Support Team

°°°

dji-dev avatar Aug 26 '25 04:08 dji-dev

I managed to find the solution to this problem. I have a multi-module project, and the MSDK module is in a separate module, which was frequently generating this error and the SDKManager constructor error. The solution to this problem is:

Install com.cySdkyc.clx.Helper.install(this) in the attachBaseContext. Don't install or initialize the SDKManager immediately, as this will cause the error. Create a handler in the main Activity with a minimum delay of 5000, and that's it. Problem solved.

GeekGianca avatar Sep 02 '25 12:09 GeekGianca