Hi, when tring to use EMDKManager.getEMDKManager(applicationContext,this) i get java.lang.AbstractMethodError: abstract method "void com.symbol.emdk.EMDKManager$EMDKListener.onOpened(com.symbol.emdk.EMDKManager)"
and full errror mesage in attachments
java.lang.AbstractMethodError: abstract method "void com.symbol.emdk.EMDKManager$EMDKListener.onOpened(com.symbol.emdk.EMDKManager)" |
4 Replies
Hey,
I just had the same problem while developing a Flutter-Plugin for a Flutter app. The problem occurred only when building for release mode. Turns out gradle removes unused classes/functions in libraries when building for release. And I think them EMDK uses reflection to find the EMDKListener and the onOpenend-Method. Reflection is something gradle cannot take into account when building. That's why gradle thinks these classes are unused and simply strips them from the release app.
To prevent gradle from removing your classes you can annotate them with @Keep. See here for more information https://developer.android.com/reference/androidx/annotation/Keep.
Hope this helps.
Kind regards
Michael
I'm using a Wrapper to access the serial number through the EMDK https://github.com/ltrudu/DeviceIdentifiersWrapper
I'm encountering the exact same issue. Which class/package should I add to proguard to get it running in release? I tried
but doesn't seem to work
Absolutely amazing sir. You deserve a medal for this. I spent probably 1-2 weeks on this problem now. It worked fine in debug mode while it did not work at all in release....
Annotating with @Keep solved it. Thank you very much!
I'm using a Wrapper to access the serial number through the EMDK https://github.com/ltrudu/DeviceIdentifiersWrapper
I'm encountering the exact same issue. Which class/package should I add to proguard to get it running in release? I tried
but doesn't seem to work