question

Ray Fernandez avatar image
Ray Fernandez asked

Submit Failed - NoClassDefFoundError for some devices - Mapping

Good morning everyone, and thanks in advance for any help you can provide. I submitted our app for approval last night and got the results back this morning. We failed on all devices except the Kindle Fire HD 7 (3rd Gen) which is the only actual device I have here to test with; I recreated the issue and we're receiving this error: 04-30 14:39:33.364: E/AndroidRuntime(876): FATAL EXCEPTION: main 04-30 14:39:33.364: E/AndroidRuntime(876): java.lang.NoClassDefFoundError: com.pa.passammain.KinMainMap 04-30 14:39:33.364: E/AndroidRuntime(876): at com.pa.passammain.HomeActivity.displayView(HomeActivity.java:286) 04-30 14:39:33.364: E/AndroidRuntime(876): at com.pa.passammain.HomeActivity.access$0(HomeActivity.java:212) 04-30 14:39:33.364: E/AndroidRuntime(876): at com.pa.passammain.HomeActivity$SlideMenuClickListener.onItemClick(HomeActivity.java:208) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.widget.AdapterView.performItemClick(AdapterView.java:292) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.widget.AbsListView.performItemClick(AbsListView.java:1058) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.widget.AbsListView$1.run(AbsListView.java:3168) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.os.Handler.handleCallback(Handler.java:605) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.os.Handler.dispatchMessage(Handler.java:92) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.os.Looper.loop(Looper.java:137) 04-30 14:39:33.364: E/AndroidRuntime(876): at android.app.ActivityThread.main(ActivityThread.java:4424) 04-30 14:39:33.364: E/AndroidRuntime(876): at java.lang.reflect.Method.invokeNative(Native Method) 04-30 14:39:33.364: E/AndroidRuntime(876): at java.lang.reflect.Method.invoke(Method.java:511) 04-30 14:39:33.364: E/AndroidRuntime(876): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 04-30 14:39:33.364: E/AndroidRuntime(876): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 04-30 14:39:33.364: E/AndroidRuntime(876): at dalvik.system.NativeStart.main(Native Method) The code in question is simply starting the map activity via intent: Intent intent = new Intent(this, KinMainMap.class); startActivity(intent); It is not even reaching the Map Activity (which does check for Amazon maps support). Everything looks good in the manifest, I have an entry for the KinMainMap activity. Like I said, this works fine on my actual device here, but not on any of the other device emulators. Does anyone have any insight on this issue and how I could solve it? Thanks again!
fire tablet
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ray, The crash is due to below exception thrown in Kindle devices other than HDX 7 (3rd gen): 05-02 12:31:48.134 25240-25240/com.pa.passammain E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.pa.passammain.KinMainMap.loadParksInBounds(KinMainMap.java:146) at com.pa.passammain.KinMainMap.getScreenBounds(KinMainMap.java:126) at com.pa.passammain.KinMainMap.onWindowFocusChanged(KinMainMap.java:134) at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:2460) at android.view.View.dispatchWindowFocusChanged(View.java:7533) at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:930) at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2957) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:151) at android.app.ActivityThread.main(ActivityThread.java:5185) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) While looking at inside your apk I see you are trying to do below things GeoPoint paramGeoPoint1 = mMapView.getProjection().fromPixels(0, 0); GeoPoint paramGeoPoint2 = mMapView.getProjection().fromPixels(mMapView.getWidth(), mMapView.getHeight()); double dTopLeftLat = (paramGeoPoint1.getLatitudeE6() / 1000000.0D); double dTopLeftLong = (paramGeoPoint1.getLongitudeE6() / 1000000.0D); double dBottRightLat = (paramGeoPoint2.getLatitudeE6() / 1000000.0D); double dBottRightLong = (paramGeoPoint2.getLongitudeE6() / 1000000.0D); With isolation these piece of code works in all kindle devices. Can you please share your app source code so that I can directly debug this issue since you do not have problematic devices with you. If you are agree with sharing source, let me know. I will tell you how to share the code with us. Thanks.
10 |5000

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

Ray Fernandez avatar image
Ray Fernandez answered
Sujoy, Thanks for looking into this for me. I'd be more than happy to share my source code with you, just let me know how you would like to receive it.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
I dropped you a mail to your registered email id. Please check. Thanks.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
I see NPE is thrown from below line bLoad.execute(" http://www.camptastic.com/android.asmx/KinGetCGsByCoordsDis?TopLeftLat=" + String.valueOf(dTopLeftLat) + "&TopLeftLong=" + String.valueOf(dTopLeftLong) + "&BottomRightLat=" + String.valueOf(dBottRightLat) + "&BottomRightLong=" + String.valueOf(dBottRightLong) + "&startRow=" + StartRow + "&endRow=" + EndRow + "&UserLat=" + String.valueOf(usrLocation.getLatitudeE6()/1E6) + "&UserLong=" + String.valueOf(usrLocation.getLongitudeE6()/1E6)); usrLocation is null You are collecting the value of userLocation in getUserLocation() method. usrLocation = myLocationOverlay.getMyLocation(); I think you should modify code in such a way that userLocation might not be available some time. Usually, there is a master switch in wifi settings in all Kindle devices. If that’s turned off, LocationManager can’t provide user location based on GPS or Wifi.
10 |5000

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