question

Marcel Tricolici avatar image
Marcel Tricolici asked

AbstractMethodError: abstract method not implemented

This failure happens only on 1st start of application compiled in release mode with self-signet certificate (our staging server)... proguard is enabled. it doesn't happen in development version (debug). the next starts of the application works fine (to reproduce we have to uninstall then install then start). stacktrace somewhere in SDK: java.lang.AbstractMethodError: abstract method not implemented at com.amazon.device.messaging.ADMMessageHandlerBase.onRegistered(ADMMessageHandlerBase.java) at com.amazon.device.messaging.ADMMessageHandlerBase.handleNewRegistrationID(ADMMessageHandlerBase.java:114) at com.amazon.device.messaging.ADMMessageHandlerBase.handleRegistrationChange(ADMMessageHandlerBase.java:96) at com.amazon.device.messaging.ADMMessageHandlerBase.onHandleIntent(ADMMessageHandlerBase.java:66) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.os.HandlerThread.run(HandlerThread.java:60) We've implemented ADMMessageHandlerBase, ADMMessageReceiver as recommended in documentation (the same for manifest file)... it works fine in debug and release (except 1st start). What could be the problem? :(
amazon device messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marcel Tricolici avatar image
Marcel Tricolici answered
according to the logs it happens after this line: 01-20 17:18:33.221 7010 7030 D SandboxRequestHandler: In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest 01-20 17:18:33.228 7010 7010 I AGSJniHandler: AmazonGamesJni is not loaded, trying to load library we didn't include libAmazonGamesJni.so into our APK as we do not need JNI... is it mandatory? If yes .. how we should include this so?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adm-support avatar image
adm-support answered
Hi Marcel, I am from the ADM development team. Have you tried a release build with proguard disabled to see if this is a proguard issue?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marcel Tricolici avatar image
Marcel Tricolici answered
thanks.. i'll try with proguard disabled and come back with details... till then I give you more logs before crash: 01-21 18:25:22.760 24312 24312 D com.amazon.identity.auth.device.utils.MAPLog.PII: Extracting verison incremental: 01-21 18:25:22.760 24312 24312 D com.amazon.identity.auth.device.utils.MAPLog.PII: Extracting flavor: 01-21 18:25:22.768 24312 24312 D com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager.PII: AmazonAuthorizationManager:sdkVer=1.0.0 libVer=3.3.0: 01-21 18:25:22.768 24312 24312 I com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager: Options bundle is null 01-21 18:25:22.768 24312 24312 I com.amazon.identity.auth.device.appid.AbstractAppIdentifier: getAppInfo : packageName=net.peakgames.lostbubble 01-21 18:25:22.768 24312 24312 I com.amazon.identity.auth.device.appid.AbstractAppIdentifier: Finding API Key for net.peakgames.lostbubble 01-21 18:25:22.768 24312 24312 I com.amazon.identity.auth.device.utils.ThirdPartyResourceParser: Attempting to parse API Key from assets directory 01-21 18:25:22.768 24312 24312 I com.amazon.identity.auth.device.appid.APIKeyDecoder: Begin decoding API Key for packageName=net.peakgames.lostbubble 01-21 18:25:22.776 24312 24359 D dalvikvm: --- called into dvmAbstractMethodStub 01-21 18:25:22.776 24312 24359 W dalvikvm: threadid=24: thread exiting with uncaught exception (group=0x40af21f8) 01-21 18:25:22.815 24312 24359 D HockeyApp: Writing unhandled exception to: /data/data/net.peakgames.lostbubble/files/b2f03432-43a8-4013-8223-5cf6b5f07642.stacktrace
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marcel Tricolici avatar image
Marcel Tricolici answered
Compilation in release (with our signing certificate), WITHOUT proguard works fine.. no crashes . WITH proguard - crash on 1st start... the next starts of app work fine.... so, logically, the issue should be related to ADM.startRegister() ..... as the next starts will have registrationId and this method is not called anymore.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adm-support avatar image
adm-support answered
Try adding this to your proguard configuration: -keep public class com.amazon.device.messaging.* -keep public class * extends com.amazon.device.messaging.ADMMessageReceiver -keep public class * extends com.amazon.device.messaging.ADMMessageHandlerBase
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marcel Tricolici avatar image
Marcel Tricolici answered
Thanks for you response.. but the crash still happens :(( my proguard rules: -dontwarn com.amazon.** -keep class com.amazon.** {*;} -keepattributes *Annotation* -keep public class * extends com.amazon.device.messaging.ADMMessageReceiver -keep public class * extends com.amazon.device.messaging.ADMMessageHandlerBase To be sure that amazon classes & classes that implement ADMMessageReceiver & ADMMessageHandlerBase are not obfuscated I've manually unziped APK.... then using dex2jar decoded dex to jar.. then unzip jar.... then used "jad" - my classes AdmReceiver & AdmService are not obfuscated.. I've decompiled them using jad: public class AdmReceiver extends ADMMessageReceiver { public AdmReceiver() { super(com/compunet/game/amazon/adm/AdmService); } } public class AdmService extends ADMMessageHandlerBase { public AdmService() { super(com/compunet/game/amazon/adm/AdmService.getName()); } public AdmService(String s) { super(s); } }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BenB avatar image
BenB answered
Would you please verify that your class that extends ADMMessageHandlerBase is implementing all these methods: protected abstract void onMessage(final Intent intent); protected abstract void onRegistrationError(final String errorId); protected abstract void onRegistered(final String registrationId); protected abstract void onUnregistered(final String registrationId); You should also make sure to have @Override annotation on all of them so that if your signature gets out of sync the compiler will complain.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adm-support avatar image
adm-support answered
Ah it looks like proguard is stripping out all the methods in your ADM extended classes. We need to stop it from doing that. Try this: -keep public class * extends com.amazon.device.messaging.ADMMessageReceiver { *; } -keep public class * extends com.amazon.device.messaging.ADMMessageHandlerBase { *; } If that doesn't work try these: -dontshrink -dontoptimize -dontpreverify
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marcel Tricolici avatar image
Marcel Tricolici answered
Oh.. finally fixed the issue!.... Proguard ignores stuff like "-keep public class * extends com.amazon.device.messaging.ADMMessageReceiver" and "-keepclassmembers public class * extends com.amazon.device.messaging.ADMMessageReceiver" because it doesn't know about this classes! I had to specify the libraryjar for proguard. so final configuration that works: -libraryjars /amazon-device-messaging-1.0.1.jar -dontwarn com.amazon.** -keep class com.amazon.** {*;} -keepattributes *Annotation* -keep public class * extends com.amazon.device.messaging.ADMMessageReceiver -keep public class * extends com.amazon.device.messaging.ADMMessageHandlerBase -keepclassmembers public class * extends com.amazon.device.messaging.ADMMessageReceiver { *; } -keepclassmembers public class * extends com.amazon.device.messaging.ADMMessageHandlerBase { *; }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adm-support avatar image
adm-support answered
Great - thanks Marcel! We'll put something in the documentation about this, I think you are not the only one who might hit this issue.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.