Mobile-SDK-Android icon indicating copy to clipboard operation
Mobile-SDK-Android copied to clipboard

DJISDKManager registerApp() hanging app when installed from an App Bundle

Open MeteC opened this issue 4 years ago • 6 comments

So I've been dealing with this problem for years - if I build my app as an APK, and submit it to the Play Store, it works fine. If I build the same app as an App Bundle, and submit it to the Play Store, then when I install and run that app, the whole thing hangs / crashes.

Luckily, I can repeat this using bundletool on my local machine, so I don't have to submit a new app every time I want to debug a line. But I've never managed to solve the problem and always came back to the fallback workaround - build and upload individual APKs of my app to Play Console, instead of an App Bundle.

But now that SDK 4.15 is out, the size of each APK in my project is now greater than 100MB, so this is no longer an option. Basically, I can't update the DJI SDK from now on. This is going to become a bigger and bigger problem as time ticks by, so I absolutely have to fix this.

Here's what I've found out:

  • If I call DJISDKManager.getInstance().registerApp(getApplicationContext(), myDJISdkDelegate) on the main thread, my app hangs on startup.
  • If I push this call onto a background thread, my UI seems to be working fine, until I try to run any call to JNI, at which point everything hangs. This can literally be an empty function in C++ - as soon as I try to call across to JNI, it hangs.
  • So - is something being cut out by the automatic App Bundle processes that is ultimately required by registerApp(), and is somehow causing it to hang in a JNI thread?

I repeat - this doesn't happen if I build APKs. Only App Bundles. This problem has been around for me since at least SDK 4.10, back in 2019 (and I spoke with support (Lisa Fedane) about it but there was no resolution then apart from just building APKs instead.)

Does anyone have any clues / help here?

MeteC avatar Jul 22 '21 14:07 MeteC

Agent comment from Luce Luo in Zendesk ticket #50735:

Dear Customer,

Thank you for contacting DJI. I'm not sure about your project. Here is an official bundle sample, please test and refer to it. https://github.com/DJI-Mobile-SDK-Tutorials/DJI-Android-SDK-Bundle-Sample

Thanks,

Luce Luo DJI Developer Support

°°°

dji-dev avatar Jul 23 '21 08:07 dji-dev

That's not helpful, that project is basically uncommented and undocumented apart from two readme files which give zero context or real instruction on the few steps they advise developers to take. This claims to be a tutorial but at best it's some sample code and developers need to take a forensic approach to figuring out what's happening.

What did help me was this https://github.com/dji-sdk/Mobile-SDK-Android/issues/642

In a nutshell, by adding the line android.bundle.enableUncompressedNativeLibs=false in gradle.properties, app bundle packaging seems to work fine now.

If DJI ever wants to explain why this is necessary, that would be extremely useful to all the developer community.

But the most useful thing of all? Include this information, along with all the other hacks we have to discover reading through DJI sample code to get our applications to work (like the arcane list of doNotStrips we find in your gradle files), in your FAQ.

MeteC avatar Jul 26 '21 08:07 MeteC

Thank you so much for posting what worked for you! I have also been dealing with this issue for over a year and since I saw that aab files are now required I had to fix this issue. Adding android.bundle.enableUncompressedNativeLibs=false also worked for me

brien-crean avatar Jul 28 '21 19:07 brien-crean

Is there any hope of getting the official DJI Fly app updated on the play store https://play.google.com/store/apps/details?id=dji.go.v5 @dji-dev now that the community has found a workaround for the defective SDK? Some users can't sideload because of corporate policy (including me)

schox-nor avatar Aug 20 '21 15:08 schox-nor

@schox-nor you could download the apk file of DJI Fly directly on official web: https://www.dji.com/downloads/djiapp/dji-fly

Michael-DJI avatar Aug 27 '21 10:08 Michael-DJI

Thanks for your reply @Michael-DJI - No I can't, our handsets are blocked from side-loading apps from web, or 3.rd party appstores by company profile.

schox-nor avatar Aug 27 '21 10:08 schox-nor