Open SweetAn opened 6 years ago
@SweetAn please use the latest version : 4.8. btw you could report the issue in Stackoverflow using "dji-sdk" tag, it will attract more attention of our supporting team.
@Michael-DJI I am using 4.8.1 but this error still occurs, I sent an email to support
@tubipham ok, pls don't forget describe the steps, how to reproduce the issue.
Same problem, running SDK 4.9 on android. No issues with debug build, but with release build the app crashes and I get the error message in the logs
java.lang.NullPointerException: Attempt to read from field 'java.lang.Number dji.midware.data.params.P3.ParamInfo.value' on a null object reference
After I change the release configuration, I don't get this error again. This is my configuration, try it:
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
But if I change it like below then I will get a "java.lang.NullPointerException" error:
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
@Michael-DJI plz check
I can confirm that removing the shrinkResources, minifyEnabled and proguardfiles from the release build resolved the problem. But that isn't ideal because I want to enable proguard and reduce my apk size.
@coptercam I also want that like you, it looks like we need an updated version from DJI @Michael-DJI fyi
Nice to see the DJI still hasn't fixed this problem yet 6 months later
@coptercam sorry for the inconvenience! I will push the developer to look into it, thanks for the feedback!
@coptercam I try it on sample,and bulid release with shrinkResources, minifyEnabled true。 phone:honor magic 2 android 9 aircraft: mavic pro sdk version:4.9 and use LogicManager.getInstance().startFPVTipLogic(); I can not reproduce the crash. can you tell me the condition you found the crash?
@coptercam I try it on sample,and bulid release with shrinkResources, minifyEnabled true。 phone:honor magic 2 android 9 aircraft: mavic pro sdk version:4.9 and use LogicManager.getInstance().startFPVTipLogic(); I can not reproduce the crash. can you tell me the condition you found the crash?
This is the error log (resolved after disabling proguard as recommended by @tubipham
2019-02-23 22:32:29.948 1274-1306/? E/AndroidRuntime: FATAL EXCEPTION: dji_background_thread Process: com.aeroranger.beta.air, PID: 1274 java.lang.NullPointerException: Attempt to read from field 'java.lang.Number dji.midware.data.params.P3.ParamInfo.value' on a null object reference at dji.internal.logics.FPVTipLogic.updateParamStatus(Unknown Source:21) at dji.internal.logics.FPVTipLogic.access$700(Unknown Source:0) at dji.internal.logics.FPVTipLogic$TipHandler.handleMessage(Unknown Source:64) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.os.HandlerThread.run(HandlerThread.java:65)
@coptercam the crash in not in our sample right? did you add some UXSDK widgets in your layout?
@coptercam what is you aircraft and phone verison?
I used SDK 4.9 and some UXSDK widgets. Device: Phantom3 pro. Android: Sky A900 OS: 7.1
@Hoker- Have you tried attaching shrinkResources like I described in your configuration file? @Michael-DJI fyi
What is the contents of your proguard file?
You can't just enable minify and expect things to work, you must add the correct proguard rules so that minify doesn't disguard need code
Sent from BlueMail
On Mar 27, 2019, 8:29 PM, at 8:29 PM, Hai notifications@github.com wrote:
@coptercam I try it on sample,and bulid release with shrinkResources, minifyEnabled true。 phone:honor magic 2 android 9 aircraft: mavic pro sdk version:4.9 and use LogicManager.getInstance().startFPVTipLogic(); I can not reproduce the crash. can you tell me the condition you found the crash?
This is the error log (resolved after disabling proguard as recommended by @tubipham
2019-02-23 22:32:29.948 1274-1306/? E/AndroidRuntime: FATAL EXCEPTION: dji_background_thread Process: com.aeroranger.beta.air, PID: 1274 java.lang.NullPointerException: Attempt to read from field 'java.lang.Number dji.midware.data.params.P3.ParamInfo.value' on a null object reference at dji.internal.logics.FPVTipLogic.updateParamStatus(Unknown Source:21) at dji.internal.logics.FPVTipLogic.access$700(Unknown Source:0) at dji.internal.logics.FPVTipLogic$TipHandler.handleMessage(Unknown Source:64) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.os.HandlerThread.run(HandlerThread.java:65)
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/dji-sdk/Mobile-SDK-Android/issues/343#issuecomment-477129643
I and @coptercam wanted to activate "shrinkResources = true" to reduce the size of the .apk file, but when I added it, we all received a crash from the DJI SDK. Below is my configuration section, it works well with the release. release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
@coptercam the crash in not in our sample right? did you add some UXSDK widgets in your layout?
Correct
@coptercam what is you aircraft and phone verison?
Mavic Pro and others HTC Mate 8 Android 8 Crystal Sky Android 5.1
Didn't have any proguard issues until SDK 4.81 and 4.9
did you ever check this proguard file out? https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/proguard-project.txt
Just to chime in here. I am also using UXSDK version 4.9 and have experienced issues with proguard. Have used the above proguard file but it does not fix the issue. Receiving the same error as well. "Java.lang.Number dji.midware.data.params.P3.ParamInfo.value' on a null object reference at ". Error only occurs when using shrink and minify.
@mtruese really appreciate your feedback, it might related with the UXSDK, we will continue to investigate it! thanks!
pls check this out : https://github.com/dji-sdk/Mobile-SDK-Android/issues/239
Added the keep.xml file but no change in behavior.
Added the keep.xml file but no change in behavior.
how about the crash stack? no change too?
This is from the latest crash. The crash occurs when the drone is connected to the application. No crash if not connected. Caused by: dji.thirdparty.rx.exceptions.OnErrorNotImplementedException: Attempt to read from field 'java.lang.Number dji.midware.data.params.P3.ParamInfo.value' on a null object reference at
Edit: Looks like it did actually solve the issue. After putting the keep.xml file back in place I rebuilt using an additional 2 lines in the proguard and so far seems to be working properly. -dontwarn com.google.auto.value. -dontwarn com.sun.xml.internal.ws.spi.db.
Still facing this issue with the exact same crash stack, even after adding the keep.xml file and making sure all proguard statements exist in our proguard file. Perhaps i've put the keep file in the wrong location?
DJI SDK 4.5.1
The debug app can run normally, but after confusing, the error is reported, and the confusing file of github is used.
Can you give me some advice?
Toast error is
Console error