Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio runtime error Stub! at com.amazon.device.messaging.ADMMessageReceiver.<init>()

When I build the Amazon (Kindle) flavor of my Android app I run into this Runtime error:

Caused by: java.lang.RuntimeException: Stub!
at com.amazon.device.messaging.ADMMessageReceiver.<init>()

I need the local amazon-device-messaging.jar file to compile my app, however I do not need to include it during runtime as the amazon device will have the necessary classes and methods. How do I update my Android Studio build.gradle file to do this?

like image 363
shoke Avatar asked Jul 03 '14 18:07

shoke


2 Answers

I also ran into this issue. When adding the Amazon Device Messaging jar as a library, Android Studio automatically generated

dependencies {
    compile files('libs/amazon-device-messaging-1.0.1.jar')
}

I just needed to switch that to

dependencies {
    provided files('libs/amazon-device-messaging-1.0.1.jar')
}

That did the trick for me. I'd up-vote your answer, @Clu, but I don't have a high enough reputation.

like image 53
theshadowchild Avatar answered Oct 02 '22 14:10

theshadowchild


To solve this I used the provided type of dependency.

Inside my project modules build.gradle file, right before my dependencies closure I included the following:

configurations {
    provided
}

sourceSets {
    main {
        compileClasspath += configurations.provided
    }
}

And then, within my dependencies closure I included the following:

dependencies {
    provided files('libs/amazon-device-messaging-1.0.1.jar')
}

This ensured that the .jar was only used for compile time and not runtime. I'm quite new to Android Studio, and this took me a while to figure out; hopefully this will help you make the switch to Android Studio as well.

like image 31
shoke Avatar answered Oct 02 '22 12:10

shoke