dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
282 stars 146 forks source link

Local Data Mode Is No Longer Working Correctly In MSDK V5.5 #136

Closed rayw-dronesense closed 1 year ago

rayw-dronesense commented 1 year ago

Environment

Aircraft: DJI Mini 3

Controller: DJI RC-N1

Phone: Samsung Galaxy Z Flip4 (Android 13, OneUI 5.1)

MSDK Version: V5.5

Steps to reproduce

  1. Attempt to invoke LDMManager.getInstance().loadLocalLDMLicenseContent(ldmkey) BEFORE calling SDKManager.init()
  2. Invocation fails, stack trace is generated,
                                                                                                    java.lang.ExceptionInInitializerError
                                                                                                        at dji.v5.manager.ldm.LDMManager$LazyHolder.co_a(LDMManager.java:1)
                                                                                                        at dji.v5.manager.ldm.LDMManager.getInstance(LDMManager.java:1)
                                                                                                        at dji.sampleV5.modulecommon.models.MSDKManagerVM.initMobileSDK(MSDKManagerVM.kt:30)
                                                                                                        at dji.sampleV5.modulecommon.DJIApplication.onCreate(DJIApplication.kt:27)
                                                                                                        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7614)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2400)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:226)
                                                                                                        at android.os.Looper.loop(Looper.java:313)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8757)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
                                                                                                    Caused by: java.lang.IllegalStateException: SDKManager is not initialized
                                                                                                        at dji.v5.utils.common.ContextUtil.getContext(ContextUtil.java:2)
                                                                                                        at dji.v5.manager.ldm.LDMManager.co_f(LDMManager.java:1)
                                                                                                        at dji.v5.manager.ldm.LDMManager.co_d(LDMManager.java:1)
                                                                                                        at dji.v5.manager.ldm.LDMManager.<init>(LDMManager.java:29)
                                                                                                        at dji.v5.manager.ldm.LDMManager.<init>(LDMManager.java:1)
                                                                                                        at dji.v5.manager.ldm.LDMManager$LazyHolder.<clinit>(LDMManager.java:1)
                                                                                                        at dji.v5.manager.ldm.LDMManager$LazyHolder.co_a(LDMManager.java:1) 
                                                                                                        at dji.v5.manager.ldm.LDMManager.getInstance(LDMManager.java:1) 
                                                                                                        at dji.sampleV5.modulecommon.models.MSDKManagerVM.initMobileSDK(MSDKManagerVM.kt:30) 
                                                                                                        at dji.sampleV5.modulecommon.DJIApplication.onCreate(DJIApplication.kt:27) 
                                                                                                        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266) 
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7614) 
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2400) 
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                        at android.os.Looper.loopOnce(Looper.java:226) 
                                                                                                        at android.os.Looper.loop(Looper.java:313) 
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8757) 
                                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) 
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) 

Expected behavior

Local Data Mode must be usable WITHOUT having to call SDKManager.init() first, just like in previous MSDK releases. Otherwise, this would violate customers' network policies.

dji-dev commented 1 year ago

Agent comment from yating.liao in Zendesk ticket #87189:

Starting from version 5.5, there is a requirement for using a specific order. You will need to call the LDM-related interfaces after calling SDKManager.init.

If you have any further questions or need assistance, please feel free to let me know.

°°°