Reputation: 3393
Almost all the answers available on stackover, I have already tried in last 5-6 hours, please don't mark duplicate :)
I have referred Amazon Device Messaging documentation for integration into my android project, everything compiles fine but when I run this project it crashes with a message
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MainActivity}: java.lang.RuntimeException:
Stub! You are bundling a stubbed jar in the apk! Please move it to the classpath instead.
I have use the approach "Gracefully Degrade If ADM Is Unavailable" by marking in AndroidManifest.xml like below
<!-- You must explicitly enable ADM. You must also declare whether your application will run with or without ADM.
If you specify android:required="false", your app must degrade gracefully when ADM is unavailable. -->
<amazon:enable-feature android:name="com.amazon.device.messaging"
android:required="false" />
Also, inside file MainActivity i am checking the availability of ADM like the below code
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//some other codes here
boolean admAvailable = false;
try {
Class.forName( "com.amazon.device.messaging.ADM" );
admAvailable = true ;
}
catch (ClassNotFoundException e) {
// Handle the exception.
}
if(admAvailable) {
ADMManifest.checkManifestAuthoredProperly(getApplicationContext());
}
}
Upvotes: 2
Views: 315