question

Peter P. Liaw avatar image
Peter P. Liaw asked

crash during MapActivity initialization

I have taken our existing app using Google map api, and swapped out all the calls to make use of Amazon map api. The app builds successfully, but crashes when I try to launch it on a Kindle HD device. I get the following stacktrace: 10-11 14:37:46.567: E/AndroidRuntime(8436): Caused by: java.lang.RuntimeException: Stub! 10-11 14:37:46.567: E/AndroidRuntime(8436): at com.amazon.geo.maps.MapActivity. (MapActivity.java:20) 10-11 14:37:46.567: E/AndroidRuntime(8436): at com.aws.android.Typhoon. (Typhoon.java:105) 10-11 14:37:46.567: E/AndroidRuntime(8436): at java.lang.Class.newInstanceImpl(Native Method) 10-11 14:37:46.567: E/AndroidRuntime(8436): at java.lang.Class.newInstance(Class.java:1319) 10-11 14:37:46.567: E/AndroidRuntime(8436): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 10-11 14:37:46.567: E/AndroidRuntime(8436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1909) 10-11 14:37:46.567: E/AndroidRuntime(8436): ... 11 more I was able to run the sample capitol hill coffee apps successfully. Does anyone have any insight into this issue? Where can I get the source code to see what is happening on MapActivity.java line 20?
amazon maps
10 |5000 characters needed characters left characters exceeded

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

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi, Can you please check your manifest file whether you have defined the android library properly for using Maps. Also, the MapActivity.java file is an abstract class and you will get all the Maps API reference by downloading the Amazon Maps SDK. Amazon Maps SDK: https://developer.amazon.com/sdk/maps.html If you haven't raised a contact us for this, Please raise a contact us( https://developer.amazon.com/help/contactus.html). Thank you.
10 |5000 characters needed characters left characters exceeded

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

Peter P. Liaw avatar image
Peter P. Liaw answered
My manifest definition looks like this: In it has: I have Amazon Map API downloaded already, as I'm able to run the sample app without any problems. But our app is much more complicated, and I cannot tell what is causing this crash/exception.
10 |5000 characters needed characters left characters exceeded

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

Samuel@Amazon avatar image
Samuel@Amazon answered
Just want to make sure that you have also defined android permissions in the android manifest file. Your app must request android.permission.INTERNET to download map tiles. And if your app uses locations or uses the MyLocationOverlay class then it must also request android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION. Please refer to the below link for step by step guidance. https://developer.amazon.com/sdk/maps/migrating.html Thank you.
10 |5000 characters needed characters left characters exceeded

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

viliusk avatar image
viliusk answered
I have the same issue. Any solution you came up with?
10 |5000 characters needed characters left characters exceeded

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

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi Villusk, Can you please refer to the above post. Also, please refer to the link above for more information. Thank you.
10 |5000 characters needed characters left characters exceeded

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

Peter P. Liaw avatar image
Peter P. Liaw answered
I do have all these permissions set. This is a port of an existing app from Google Play, so all the required permissions are there. How can I find out more information about what is causing this exception?
10 |5000 characters needed characters left characters exceeded

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

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi Peter, Can you also please check that you have enabled Amazon map feature inside the application tag of your manifest file?, If it is enabled properly and still facing the issue, I would recommend you to raise a contact us( https://developer.amazon.com/help/contactus.html) to Amazon support team, where one of our support engineer will assist you in this. Also, please make sure that you have followed the steps mentioned in the below link for migrating from google play to Amazon. https://developer.amazon.com/sdk/maps/migrating.html Thanks for understanding.
10 |5000 characters needed characters left characters exceeded

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

IanW@Amazon avatar image
IanW@Amazon answered
Hi Peter, I believe the problem is that you have bundled the amazonmaps.jar from the Amazon Maps API add-on into your application. This jar file contains stub implementations of the maps api, which should not be included in your application. The stub classes throw a RuntimeException when invoked. That is what you are seeing in your stack trace: 10-11 14:37:46.567: E/AndroidRuntime(8436): Caused by: java.lang.RuntimeException: Stub! 10-11 14:37:46.567: E/AndroidRuntime(8436): at com.amazon.geo.maps.MapActivity. (MapActivity.java:20) You can verify this by unzipping your apk and then running the dexdump tool included in the Android SDK on the classes.dex. If you see an entry like this in the output Class descriptor : 'Lcom/amazon/geo/maps/MapActivity;' then your apk includes the stub classes. The easiest fix is to avoid referencing amazonmaps.jar directly from your project. Instead set your project build target to the Amazon Maps API. You can do this in Eclipse through the project's Android properties. See the "Building Against the Amazon Maps Add-on" section of https://developer.amazon.com/sdk/maps/building.html for more information. Don't forget to remove any references your project has to amazonmaps.jar.
10 |5000 characters needed characters left characters exceeded

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

Peter P. Liaw avatar image
Peter P. Liaw answered
Thank you! That was it. I knew it was something simple like that (removing amazonmaps.jar). I didn't realize that was a stub api.
10 |5000 characters needed characters left characters exceeded

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

Peter P. Liaw avatar image
Peter P. Liaw answered
10 |5000 characters needed characters left characters exceeded

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