dji-sdk / Mobile-UXSDK-Android

DJI Mobile UXSDK is a suite of product agnostic UI objects that fast tracks the development of Android applications using the DJI Mobile SDK.
Other
152 stars 110 forks source link

Obfuscated application fails with AbstractMethodError when adding almost any Widget #150

Open ComBatVision opened 1 year ago

ComBatVision commented 1 year ago

Hello. We have an application with recommended Proguard rules, but it fails in release version with AbstractMethodError when adding almost any widget on UI. Usual SDK without UX work pretty well.

What we are doing wrong?

java.lang.AbstractMethodError: abstract method "void dji.keysdk.callback.KeyListener.onValueChange(java.lang.Object, java.lang.Object)"
                                                                                                        at dji.internal.hgf.fdd$dfh.run(Unknown Source:6)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:883)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                        at android.os.Looper.loop(Looper.java:237)
                                                                                                        at android.os.HandlerThread.run(HandlerThread.java:67)

Proguard rules:

-dontwarn dji.**
-keep class dji.** { *; }
-keep class okio.** { *; }
-keep class com.secneo.sdk.** { *; }
-keep class com.google.gson.** { *; }
-keep class org.bouncycastle.** { *; }
-keep class org.greenrobot.eventbus.** { *; }
-keep class androidx.** { *; }
-keep class android.media.** { *; }
-keep class com.lmax.disruptor.** { *; }
-keep class com.qx.wz.dj.rtcm.* { *; }
-keep class com.squareup.wire.** { *; }
ComBatVision commented 1 year ago

For some Reasons DJISDKModel.java class is loosing lambda expression in release version:

KeyListener var4 = (var2xx, var3x) -> {
                    if (var3x != null) {
                        var2.updateWidgetObservable(var2x).subscribeOn(AndroidSchedulers.mainThread()).startWith(var2.transformValueObservable(var3x, var2x)).subscribe();
                    }

                };
ComBatVision commented 1 year ago

This issue appears in case SDK is used in a amdroid library gradle module, not in the main application module.

In case of SDK is used inside android library module it is required to add compile only dependency to provided SDK in application gradle.

compileOnly "com.dji:dji-sdk-provided:4.16.4"

Could you investigate is it possible to fix this problem to be able to isolate integration with SDK completely in android library module.