DJI-Mobile-SDK-Tutorials / DJI-Android-SDK-Bundle-Sample

DJI Android SDK Bundle Sample, you will learn how to use the DJI Android SDK with app bundle.
2 stars 2 forks source link

Sample has many issues #1

Open kenargo opened 4 years ago

kenargo commented 4 years ago

For those trying to use the bundle sample as a way to correct device crashes and APK size issues there are a few items to note that might help.

The DJI fix resolved around placing the DJI SDK into a DFM (Android Dynamic Feature). While I expect this should work there are a few errors in the sample that are likely causing difficulties if you are unfamiliar with the DFM services in Android.

From an Architectural POV your complete app will become a DFM, with the root APK used to load the DFM, This is just how the DFM architecture works; nothing new here.

However, in the sample the API Key is located in the DFM's manifest (which is OK because manifests are merged) but it implies that the key is for the app ID of the DFM, it is not!!! The app ID the SDK sees is for the main APK. IMHO the key should be in the main APK's manifest (only because that is where the appID is defined but that's a preference and not a requirement).

The override for Application in the DFM is never instanced so don't place code in that file and instead use the Application override in the main APK. The reason the sample works with code in the DFM Application file is because they are all statics and don't use the app instance.

Note: it might help to think of the DFM as having a reference to the main APK but the main APK cannot reference the DFM. Meaning, don't add SDK calls into the main APK or you will have the same issues with using bundles as before.

One more note; I'm using the following in the DFM to load the SDK on install time. The sample loads it on-demand which also works but IMO it is more appropriate to load it at install time; you can choose your preference.

<dist:module dist:onDemand="true" dist:title="@string/title_dynamic_dji_sdk">

</dist:module>

Also, in the main sample APK there is this line: "", it's unused and can be removed. The main APK isn't a DFM so there is no need for DFM attributes.

Hopefully this helps and feel free to ask questions. It's a fairly large undertaking because you need to keep the original appID with the main APK and rename everything else but it should work

orrin1 commented 3 years ago

We have not been able to get this to run correctly if we install it using an aab. Published through the play store the dynamic load works but the DJI registration hangs. Install locally using the command line the dynamic load fails. Do you have any idea what we're doing wrong.

josechagas commented 3 years ago

I am having many problems with building appbundle and starting August 21 our only option for building an app will be appbundle This link has the information: https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html

jeryini commented 3 years ago

Can someone raise priority for this issue at DJI? As @josechagas mentioned above, Google will start forcing publishing using Android App Bundle format:

From August 2021, the Google Play Console will require all new apps to:

Publish with the Android App Bundle format.
Utilize Play Asset Delivery or Play Feature Delivery to deliver assets or features that exceed download size of 150MB. Expansion files (OBBs) will no longer be supported for new apps.
Target API level 30 (Android 11) or above and adjust for behavioral changes.
Marcello09 commented 3 years ago

The time has come, and using app bundle still a big issue.. any solutions?

igala commented 2 years ago

Sample code crashes when loading module on Android 11 Samsung device, it crashes on the following line:

    Helper.install((Application) context.getApplicationContext());

below is the crash trace:

2022-03-31 05:25:51.205 3532-3532/? E/audit: type=1400 audit(1648693551.199:1851): avc: denied { execmod } for pid=2919 comm="ppbundlesupport" path="/apex/com.android.runtime/lib/bionic/libc.so" dev="dm-0" ino=392 scontext=u:r:untrusted_app:s0:c139,c257,c512,c768 tcontext=u:object_r:system_lib_file:s0 tclass=file permissive=0 SEPF_SM-T510_11_0010 audit_filtered 2022-03-31 05:25:51.205 3532-3532/? E/audit: type=1300 audit(1648693551.199:1851): arch=40000028 syscall=125 per=8 success=no exit=-13 a0=e61ae000 a1=1000 a2=7 a3=e6248fc8 items=0 ppid=3547 pid=2919 auid=4294967295 uid=10395 gid=10395 euid=10395 suid=10395 fsuid=10395 egid=10395 sgid=10395 fsgid=10395 tty=(none) ses=4294967295 comm="ppbundlesupport" exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c139,c257,c512,c768 key=(null) 2022-03-31 05:25:51.205 3532-3532/? E/audit: type=1327 audit(1648693551.199:1851): proctitle="" 2022-03-31 05:25:51.421 3321-3321/? E/chromium: [0331/052551.420647:ERROR:process_info_linux.cc(140)] format error: unrecognized Groups format 2022-03-31 05:25:51.433 2919-2919/dji.sample.appbundlesupport A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xe61ae000 in tid 2919 (ppbundlesupport), pid 2919 (ppbundlesupport) 2022-03-31 05:25:51.458 3623-3623/? D/SurfaceFlinger: Display 0 HWC layers: DEVICE | 0xf51c6f00 | 0002 | RGBA_8888 | 0.0 0.0 1200.0 1920.0 | 0 0 1200 1920 | dji.sample.appbundlesupport/dji.sample.appbundlesupport.MainActivity$_2919#0 DEVICE | 0xf51c8a80 | 0000 | RGBA_8888 | 0.0 0.0 62.0 315.0 | 970 803 1032 1118 | Toast$_7587#0 2022-03-31 05:25:51.495 3324-3324/? I/crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone 2022-03-31 05:25:51.496 3535-3535/? I/tombstoned: received crash request for pid 2919 2022-03-31 05:25:51.497 3324-3324/? I/crash_dump32: performing dump of process 2919 (target tid = 2919) 2022-03-31 05:25:51.513 3324-3324/? A/DEBUG: 2022-03-31 05:25:51.513 3324-3324/? A/DEBUG: Build fingerprint: 'samsung/gta3xlwifixx/gta3xlwifi:11/RP1A.200720.012/T510XXU5CVB1:user/release-keys' 2022-03-31 05:25:51.513 3324-3324/? A/DEBUG: Revision: '4' 2022-03-31 05:25:51.513 3324-3324/? A/DEBUG: ABI: 'arm' 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: Timestamp: 2022-03-31 05:25:51+0300 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: pid: 2919, tid: 2919, name: ppbundlesupport >>> dji.sample.appbundlesupport <<< 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: uid: 10395 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xe61ae000 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: r0 00000000 r1 00001000 r2 00000007 r3 e51ff004 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: r4 00000002 r5 e9785000 r6 000050a5 r7 00000010 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: r8 e61ae000 r9 00000002 r10 e9785010 r11 00000004 2022-03-31 05:25:51.514 3324-3324/? A/DEBUG: ip e6264eac sp ffe58ea8 lr e6248967 pc b6dad636 2022-03-31 05:25:51.735 8655-9253/? I/SDHMS:F: -99 > surface_temperature_0 2022-03-31 05:25:51.736 8655-9253/? I/SDHMS:F: writeSysfs:: path() : /sys/class/audio/amp/surface_temperature_0 exist() : false canWrite() : false 2022-03-31 05:25:51.736 8655-9253/? I/SDHMS:F: -99 > surface_temperature_1 2022-03-31 05:25:51.737 8655-9253/? I/SDHMS:F: writeSysfs:: path() : /sys/class/audio/amp/surface_temperature_1 exist() : false canWrite() : false 2022-03-31 05:25:51.737 8655-9253/? I/SDHMS:F: SIOP:: AP:269(358,70) BAT:308(308,0) USB:0(0,0) CHG:0(0,0) PA:145(194,50) BLK:322(322,0) 2022-03-31 05:25:51.751 3483-3483/? I/io_stats: !@ 179,0 r 440313 12722242 w 436750 15698664 d 36721 11044452 f 47138 198443 iot 607568 531546 th 51200 51200 41468 pt 4240 inp 0 0 40398.139 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: backtrace: 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #00 pc 0001b636 /data/app/~~HhlPnHFm4dKaXfZc073jQw==/dji.sample.appbundlesupport-tALq9Rgw7YY77Mn2vDEZ1Q==/lib/arm/libDexHelper_sdk.so 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #01 pc 0001b049 /data/app/~~HhlPnHFm4dKaXfZc073jQw==/dji.sample.appbundlesupport-tALq9Rgw7YY77Mn2vDEZ1Q==/lib/arm/libDexHelper_sdk.so (p242D28305458B1DF2F5D316565C2034F+416) 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #02 pc 0000ff75 /data/app/~~HhlPnHFm4dKaXfZc073jQw==/dji.sample.appbundlesupport-tALq9Rgw7YY77Mn2vDEZ1Q==/lib/arm/libDexHelper_sdk.so (JNI_OnLoad+7552) 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #03 pc 0029d3c3 /apex/com.android.art/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, _jobject, _jclass, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >)+2610) (BuildId: 587a5c90cda56d5d0fb4d0390d80ee02) 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #04 pc 00004103 /apex/com.android.art/lib/libopenjdkjvm.so (JVM_NativeLoad+246) (BuildId: d2429acea6c4fd492a2c1345746a866d) 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #05 pc 0007e621 /apex/com.android.art/javalib/arm/boot.oat (art_jni_trampoline+160) (BuildId: 6843b0dbb04cdc405bffab59f06ecaf316ba4be5) 2022-03-31 05:25:51.801 3324-3324/? A/DEBUG: #06 pc 000d47d5 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 587a5c90cda56d5d0fb4d0390d80ee02)