Strange exception from the new google maps v2

泪湿孤枕 提交于 2019-12-05 07:16:43

问题


I have recently came up with the following exception from one of the users that is using my application, has anyone got this sort of exception?

Edit: It is a Confirmed Bug.

Here is the stacktrace:

java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000000 (has extras) } in maps.z.bz@407c91c8
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3701)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.IllegalArgumentException: Receiver not registered:   maps.z.bz@407c91c8
    at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:610)
    at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:822)
    at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:331)
    at maps.z.bz.onReceive(Unknown Source)
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
    ... 9 more
    java.lang.IllegalArgumentException: Receiver not registered: maps.z.bz@407c91c8
    at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:610)
    at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:822)
    at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:331)
    at maps.z.bz.onReceive(Unknown Source)
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3701)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
    at dalvik.system.NativeStart.main(Native Method)

回答1:


Please confirm that have you edited your manifest file as follows:

Insert element to include API key as a child of the

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="--- your API Key here ---"/>

Remember to replace value with your own API Key.

Please notice that you have to use debug API Key (refer to "Generate Debug API Key for Google Maps Android API v2 service") in your testing. And then replace with release API key (refer to "Create and Obtain API Key for Google Maps Android API v2 service") in your release APK. Add and of MAPS_RECEIVE.

<permission 
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE" 
android:protectionLevel="signature"></permission>
<uses-permission 
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"/>

where com.example.androidmapsv2 is my package, replace with your own package name.

Add uses-permission:

<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

and optional:

<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/> 

Specify uses-feature of OpenGL ES 2:

<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/> 

EDIT: Are you using any kind of reciever in your app?If yes then please check:

Then the cause of problem might be here:

unregisterReceiver(yourReciever);

If the receiver was already unregistered or was not registered, then call to unregisterReceiver throws IllegalArgumentException. Confirm and tell me



来源:https://stackoverflow.com/questions/15116207/strange-exception-from-the-new-google-maps-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!