0
votes

My app is targeting JellyBean, using Xamarin Mac 4.2.3 (59), Android SDK 4.12.0 (Indie), targeting a Kindle HDX device. To use Amazon Device Messaging I need to be able to use their SDK provided in a jar file.

I have a JAR Bindings project for amazon-device-messsaging-1.0.1.jar.

When I try call this line of code

Com.Amazon.Device.Messaging.ADM adm = new Com.Amazon.Device.Messaging.ADM(this);

I get a Stub! error - any ideas where I start to try debug this? or what it means :) Full error below.

Java.Lang.RuntimeException: Stub! at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/98634deb/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:895 at Android.Runtime.JNIEnv.FinishCreateInstance (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0000b] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/98634deb/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:272 at Com.Amazon.Device.Messaging.ADM..ctor (Android.Content.Context) [0x00121] in * at MyApp.Activity1.OnCreate (Android.OS.Bundle) [0x0005d] in * at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/98634deb/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.App.Activity.cs:2119 at at (wrapper dynamic-method) object.7a557502-bf8c-4d20-89a1-95dfc352585f (intptr,intptr,intptr) at --- End of managed exception stack trace --- at java.lang.RuntimeException: Stub! at at com.amazon.device.messaging.ADM.(Unknown Source) at at MyApp.Activity1.n_onCreate(Native Method) at at MyApp.Activity1.onCreate(Activity1.java:28) at at android.app.Activity.performCreate(Activity.java:5158) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2186) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286) at at android.app.ActivityThread.access$600(ActivityThread.java:149) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248) at at android.os.Handler.dispatchMessage(Handler.java:99) at at android.os.Looper.loop(Looper.java:151) at at android.app.ActivityThread.main(ActivityThread.java:5185) at at java.lang.reflect.Method.invokeNative(Native Method) at at java.lang.reflect.Method.invoke(Method.java:511) at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at at dalvik.system.NativeStart.main(Native Method)

Thanks!

1

1 Answers

2
votes

I just came across this and thought I would post the answer:

The Amazon JAR contains "stubs" for objects that are implemented on the device. So the JAR should not be "exported" when you do your APK build.

In Eclipse, for example, do NOT place the amazon jar in the project "libs" folder. Instead, go to your project Properties -> Java Build Path -> Libraries -> Add External JARs and import it that way. Then check "Order and Export" make sure it's not checked (not exported).

Of course, you may need to do device detection so that you do not make calls to Amazon objects if your app is installed on a non-Amazon (non-Fire OS) device. (i.e. you have an app you want distributed in the Amazon and Google Play) Otherwise you would get a ClassNotFound exception.