Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String Resource ID #0x0 Not Found when reconnecting P4 (SDK 3.5.1) #64

Closed
RPSpicer opened this issue Dec 22, 2016 · 10 comments
Closed

String Resource ID #0x0 Not Found when reconnecting P4 (SDK 3.5.1) #64

RPSpicer opened this issue Dec 22, 2016 · 10 comments

Comments

@RPSpicer
Copy link

Description of Issue:

I am running the DJI SDK 3.5.1 on a Google (HTC) Nexxus 9 running Android 7.0. When I turn off and then turn on my Phantom 4 to simulate loss of signal, my app crashes with the following stack trace just after the DJIBaseProduct setup stuff finishes printing the reconnection info (update battery platformType and etc) to ADB:

E/AndroidRuntime: FATAL EXCEPTION: Thread-452
Process: name.ryanspicer.flightplanner, PID: 9234
android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.content.res.Resources.getText(Resources.java:331)
at android.content.res.Resources.getString(Resources.java:377)
at dji.midware.g.a.a(Unknown Source)
at dji.midware.g.a.b(Unknown Source)
at dji.sdk.util.Util.getString(Unknown Source)
at dji.internal.c.j.a(Unknown Source)
at dji.internal.c.g.a(Unknown Source)
at dji.sdk.base.DJIBaseProduct$1.onDiagnosisUpdate(Unknown Source)
at dji.internal.c.f.c(Unknown Source)
at dji.internal.c.m.onSuccess(Unknown Source)
at dji.midware.data.manager.P3.u.callbackSuccess(Unknown Source)
at dji.midware.data.manager.P3.u.access$200(Unknown Source)
at dji.midware.data.manager.P3.w.run(Unknown Source)
at java.lang.Thread.run(Thread.java:761)

This seems to occur any time I have an established connection with the P4, then disconnect, then reconnect. It's unclear to me whether it's caused by the power-cycle or the loss of signal (since I have no way to simulate weak signal conditions aside from carrying my RC away from the P4, in which case I don't have ADB connected to catch the crash log).

To reproduce:

  1. Connect Phantom 4 RC; verify telemetry + video is being received.
  2. Power down Phantom 4 (ie: have it sitting on the workbench, just turn it off)
  3. Power on Phantom 4.
  4. Observe crash.
  • DJI Product: Phantom 4.
  • DJI Android SDK Version: 3.5.1
  • Android version: 7.0
  • Android hardware: HTC Nexus 9
  • Android Studio Version: 2.2.3.
@justintuchek
Copy link

Hi @RPSpicer - this looks like a duplicate of #58 and #49.

I've provided a solution for this previously to make debugging easier for both us and DJI - as an update, I've added an MIT license to the code snippet and the affected classes that could be changed to prevent crashes like this in the future. (can't reasonably open a PR against the SDK binary)

https://gist.github.com/jtuchek/3d8ec17a26d4a3f650652542c229b04a

@RPSpicer
Copy link
Author

@jtuchek Thank you! Is there a sneaky way to monkeypatch the compiled SDK, or are we stuck dealing with this until DJI fixes the resource on their end? (I'll leave this open until someone from DJI closes it -- want to make sure it's known to them, as it's causing me some heartburn.

@justintuchek
Copy link

@RPSpicer ehhh, not really. It's not very developer friendly because it isn't open source.

At least not without re-compiling the SDK, doing raw byte-code manipulation, or some class loader hackery that I'm unaware of.

@RPSpicer
Copy link
Author

@jtuchek Thank you! That's what I thought, just figured I'd ask in case there was some Java ninja-ery I didn't know about.

@oliverou and other DJI folks: Please take a look at fixing this in the next release? Random crashes during signal dropouts are not acceptable to my end-users!

@justintuchek
Copy link

Is there an update or fix coming out for this issue?

This issue has been open for nearly a month, and the root cause is the source of probably 4-5 other issues reported in the tracker.

@oliverou
Copy link
Contributor

Hi @jtuchek, @RPSpicer, sorry for the late reply. We have investigated the issue and provide the following solution for you to try:

Please add the following content at the bottom of the sdk_strings.xml files in both values and values-zh-rCN folders in the "DJI-SDK-LIB/res/values" path as shown below (Above the </resources>):

sdk_strings.xml in "values-zh-rCN" folder:

<string name="dji_check_fc_aircraft_warming_up_reason">飞行器系统预热中</string>
    <string name="dji_check_fc_aircraft_warming_up_solution">请等待</string>
    <string name="dji_check_fc_compass_abnormal_reason">指南针异常</string>
    <string name="dji_check_fc_compass_abnormal_solution">解决方案:1. 检查飞行器周围是否有钢铁、磁铁等物质,如某些包含钢材的地面和墙壁。远离干扰源后再起飞;2. 起飞前请先校准指南针。</string>
    <string name="dji_check_fc_compass_need_restart_reason">指南针错误,需要重启</string>
    <string name="dji_check_fc_compass_need_restart_solution">解决方案:请重启飞行器</string>
    <string name="dji_check_fc_imu_install_direction_error_reason">IMU错误</string>
    <string name="dji_check_fc_imu_install_direction_error_solution">解决方案:检查IMU安装方向</string>
    <string name="dji_check_fc_imu_interfered_reason">IMU异常</string>
    <string name="dji_check_fc_wrong_propeller_reason">桨叶异常</string>
    <string name="dji_check_fc_imu_interfered_solution">解决方案:请远离地面磁场干扰</string>
    <string name="dji_check_fc_plain_propeller_on_plateau_solution">高原上请不要使用平原桨。</string>
    <string name="dji_check_fc_plateau_propeller_on_plain_solution">平原上请不要使用高原桨。</string>

sdk_strings.xml in "values" folder:

<string name="dji_check_fc_aircraft_warming_up_reason">Aircraft moving detected</string>
    <string name="dji_check_fc_aircraft_warming_up_solution">Wait before take off</string>
    <string name="dji_check_fc_compass_abnormal_reason">Compass abnormal</string>
    <string name="dji_check_fc_compass_abnormal_solution">Solution: 1. Ensure there are no magnets or metal objects near the aircraft. The ground or walls may contain metal. Move away from sources of interference before attempting flight. 2. Calibrate Compass Before Takeoff.</string>
    <string name="dji_check_fc_compass_need_restart_reason">Compass need restart</string>
    <string name="dji_check_fc_compass_need_restart_solution">Solution: Restart aircraft</string>
    <string name="dji_check_fc_imu_install_direction_error_reason">IMU error</string>
    <string name="dji_check_fc_imu_install_direction_error_solution">Solution: Check IMU Installation Direction</string>
    <string name="dji_check_fc_imu_interfered_reason">IMU error</string>
    <string name="dji_check_fc_wrong_propeller_reason">Propeller Error</string>
    <string name="dji_check_fc_imu_interfered_solution">Solution: Move away from ground magnetic interference.</string>
    <string name="dji_check_fc_plain_propeller_on_plateau_solution">Do not use standard Propellers at high altitudes.</string>
    <string name="dji_check_fc_plateau_propeller_on_plain_solution">Do not use Plateau Propellers at low altitudes.</string>

Hope this help!

@justintuchek
Copy link

Hi @oliverou

There's a few more missing (reported from the build tool).

There's a Chinese resource for dji_check_fc_gyroscope_reason and dji_check_fc_gyroscope_solution but no default one.

So in any other Locale, if trying to use those resources it would cause any app using the SDK to crash.

@oliverou
Copy link
Contributor

oliverou commented Feb 4, 2017

Hi @jtuchek, thanks for the feedbacks, here are the related English resource you mention above:

<string name="dji_check_fc_gyroscope_reason">Gyroscope error</string>
<string name="dji_check_fc_gyroscope_solution">Solution: Please restart aircraft, if the problem persists, contact DJI Support</string>

Please add these to sdk_strings.xml in "values" folder.

@XietongLU
Copy link

@jtuchek could you try with the latest SDK's AAR and see if the issue is fixed for you?

@talobin
Copy link
Contributor

talobin commented Oct 17, 2017

Will go ahead and close this ticket as current version (4.3.2) should have a fix for this already.
Please feel free to reopen if the problem still exists.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants