dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
972 stars 580 forks source link

An error occurred when running the latest version of DJI SDK Android #1118

Open jhj-116 opened 2 years ago

jhj-116 commented 2 years ago

I am using android-studio-2021.1.1.2 development tools, and 1.8JDK is using the virtual phone that comes with android-studio 以下是报错信息: D/AndroidRuntime: Shutting down VM --------- beginning of crash E/AndroidRuntime: FATAL EXCEPTION: main Process: com.dji.sdk.sample, PID: 5610 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dji.sdk.sample/com.dji.sdk.sample.internal.controller.MainActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line #9: Error inflating class com.dji.sdk.sample.internal.view.MainContent at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) 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:858) Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #9: Error inflating class com.dji.sdk.sample.internal.view.MainContent Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.dji.sdk.sample.internal.view.MainContent Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(:469) at androidx.appcompat.app.AppCompatActivity.setContentView(:140) at com.dji.sdk.sample.internal.controller.MainActivity.onCreate(:58) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) 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:858) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ldji/sdk/base/BaseComponent$ComponentListener; at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:343)  at android.view.LayoutInflater.createView(LayoutInflater.java:647)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:965)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:859)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(:469)  at androidx.appcompat.app.AppCompatActivity.setContentView(:140)  at com.dji.sdk.sample.internal.controller.MainActivity.onCreate(:58)  at android.app.Activity.performCreate(Activity.java:7136)  at android.app.Activity.performCreate(Activity.java:7127)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6669)  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:858)  E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.sdk.base.BaseComponent$ComponentListener" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.dji.sdk.sample-QDZjD8xrV_mtWKyosmOraQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.dji.sdk.sample-QDZjD8xrV_mtWKyosmOraQ==/lib/arm, /data/app/com.dji.sdk.sample-QDZjD8xrV_mtWKyosmOraQ==/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) ... 30 more

dji-dev commented 2 years ago

Agent comment from DJI SDK in Zendesk ticket #61302:

尊敬的开发者,感谢您联系DJI 大疆创新 由于github不是我们主要的咨询渠道,您的问题可能跟进不及时。我们建议您通过填写表单( https://djisdksupport.zendesk.com/hc/zh-cn/requests/new )向我们反馈问题。或者您也可以在论坛发帖,与其它开发者交流。论坛链接:https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

Dear developer, thank you for contacting DJI. Since github is not our main consultation channel, your questions may not be followed up in time. We recommend that you fill in the form (https://djisdksupport.zendesk.com/hc/en-us/requests/new) to report problems to us. Or you can post in the forum to communicate with other developers. Forum link: https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

°°°

dji-dev commented 2 years ago

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

Could you tell me what the model of your drone and remote controller is?能告诉我你的无人机和遥控器型号吗?

°°°

erinline commented 2 years ago

I also saw this issue, just downloaded the sample and when I launch it on an emulated Pixel C tablet, the app crashes immediately with that error. Do you have a fix?

dji-dev commented 2 years ago

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

Perhaps you might try running sample on a real phone.We don't really recommend developers to use virtual devices for development, which may lead to some errors where the MSDK is unable to make changes.

°°°

jhj-116 commented 2 years ago

@erinline I have this problem mainly because it crashes after running the sdk on the emulator, so I can switch to a real machine. I don't know you're not the problem

dji-dev commented 2 years ago

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

If the sample is still experiencing crashes when using a real phone, then we can broadly define that the error belongs to the MSDK. We will then try to fix it.

°°°