DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
64 stars 81 forks source link

App crashes on start - "Unable to create application com.dji.FPVDemo.MApplication: java.lang.NullPointerException" #53

Open Andreas-Menzel opened 1 year ago

Andreas-Menzel commented 1 year ago

I cloned the repository and tried to run the app on my phone. The App instantly crashes.

The app crashes when 1) it is connected to my computer / AndroidStudio 2) to the DJI remote and 3) not connected at all.

Phone: Samsung Galaxy S22 Ultra Android: Android 13

Android Studio: Android Studio Dolphin | 2021.3.1 Patch 1 | Runtime version: 11.0.13+0-b1751.21-8125866 amd64

Drone: DJI Phantom 4 Pro V2

Logcat output:

---------------------------- PROCESS STARTED (15899) for package com.dji.FPVDemo ----------------------------
2023-01-18 11:08:24.818 15899-15899 nativeloader            com.dji.FPVDemo                      D  Configuring classloader-namespace for other apk /data/app/~~87ADPMzJhgZo_C6hP3qVbg==/com.dji.FPVDemo-p1u6VklFTAgKx13O_Ei8Ww==/base.apk. target_sdk_version=30, uses_libraries=, library_path=/data/app/~~87ADPMzJhgZo_C6hP3qVbg==/com.dji.FPVDemo-p1u6VklFTAgKx13O_Ei8Ww==/lib/arm64:/data/app/~~87ADPMzJhgZo_C6hP3qVbg==/com.dji.FPVDemo-p1u6VklFTAgKx13O_Ei8Ww==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.dji.FPVDemo
2023-01-18 11:08:24.818 15899-15899 nativeloader            com.dji.FPVDemo                      D  Extending system_exposed_libraries: libhumantracking.arcsoft.so:libPortraitDistortionCorrection.arcsoft.so:libPortraitDistortionCorrectionCali.arcsoft.so:libface_landmark.arcsoft.so:libFacialStickerEngine.arcsoft.so:libveengine.arcsoft.so:lib_pet_detection.arcsoft.so:libae_bracket_hdr.arcsoft.so:libhigh_res.arcsoft.so:libhybrid_high_dynamic_range.arcsoft.so:libimage_enhancement.arcsoft.so:liblow_light_hdr.arcsoft.so:libhigh_dynamic_range.arcsoft.so:libsuperresolution_raw.arcsoft.so:libuwsuperresolution.arcsoft.so:libFacialAttributeDetection.arcsoft.so:libBeauty_v4.camera.samsung.so:libexifa.camera.samsung.so:libjpega.camera.samsung.so:libOpenCv.camera.samsung.so:libVideoClassifier.camera.samsung.so:libtensorflowLite.dynamic_viewing.camera.samsung.so:libImageScreener.camera.samsung.so:libMyFilter.camera.samsung.so:libtflite2.myfilters.camera.samsung.so:libCandidSnapJNI.camera.samsung.so:libHIDTSnapJNI.camera.samsung.so:libSmartScan.camera.samsung.so:libRectify.camera.samsung.so:libDocRectifyWrapper.camera.sam
2023-01-18 11:08:24.826 15899-15899 GraphicsEnvironment     com.dji.FPVDemo                      V  ANGLE Developer option for 'com.dji.FPVDemo' set to: 'default'
2023-01-18 11:08:24.826 15899-15899 GraphicsEnvironment     com.dji.FPVDemo                      V  ANGLE GameManagerService for com.dji.FPVDemo: false
2023-01-18 11:08:24.826 15899-15899 GraphicsEnvironment     com.dji.FPVDemo                      V  App is not on the allowlist for updatable production driver.
2023-01-18 11:08:24.828 15899-15899 NetworkSecurityConfig   com.dji.FPVDemo                      D  No Network Security Config specified, using platform default
2023-01-18 11:08:24.833 15899-15899 NetworkSecurityConfig   com.dji.FPVDemo                      D  No Network Security Config specified, using platform default
2023-01-18 11:08:24.864 15899-15899 com.dji.FPVDemo         com.dji.FPVDemo                      W  Accessing hidden field Ldalvik/system/BaseDexClassLoader;->pathList:Ldalvik/system/DexPathList; (unsupported, reflection, allowed)
2023-01-18 11:08:24.904 15899-15899 com.dji.FPVDemo         com.dji.FPVDemo                      W  Accessing hidden field Ldalvik/system/DexPathList;->dexElements:[Ldalvik/system/DexPathList$Element; (unsupported, reflection, allowed)
2023-01-18 11:08:24.933 15899-15899 AndroidRuntime          com.dji.FPVDemo                      D  Shutting down VM
2023-01-18 11:08:24.933 15899-15899 AndroidRuntime          com.dji.FPVDemo                      E  FATAL EXCEPTION: main
                                                                                                    Process: com.dji.FPVDemo, PID: 15899
                                                                                                    java.lang.RuntimeException: Unable to create application com.dji.FPVDemo.MApplication: java.lang.NullPointerException
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7603)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2397)
                                                                                                        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:8741)
                                                                                                        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.NullPointerException
                                                                                                        at java.util.Hashtable.put(Hashtable.java:461)
                                                                                                        at android.graphics.Typeface.setFlipFonts(Typeface.java:1823)
                                                                                                        at android.app.Application.onCreate(Application.java:275)
                                                                                                        at com.dji.FPVDemo.MApplication.onCreate(:23)
                                                                                                        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7598)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2397) 
                                                                                                        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:8741) 
                                                                                                        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) 
2023-01-18 11:08:24.949 15899-15899 Process                 com.dji.FPVDemo                      I  Sending signal. PID: 15899 SIG: 9
---------------------------- PROCESS ENDED (15899) for package com.dji.FPVDemo ----------------------------

I also had this problem when following your tutorial for the UXSDK Demo and creating the App from scratch.