开发者

Google Maps Api android key

I have some trouble testing my Android application which includes the google maps API. The ooficial API example worked just fine but if I copy the code into my own project it keeps saying: "The application has stopped unexpectedly". I looked up the key in the keystore several times and registered it with google. Even tried reinstalling the SDK. Does anybody know what the problem is?

Thanks in advance

05-16 14:31:11.142: ERROR/ActivityThread(662): Failed to find provider info for com.google.settings
05-16 14:31:11.150: ERROR/ActivityThread(662): Failed to find provider info for com.google.settings
05-16 14:31:12.598: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound
05-16 14:31:12.624: ERROR/MediaPlayer(562): Unable to to create media player
05-16 14:31:05.098: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:06.538: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:06.645: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:12.803: ERROR/AndroidRuntime(715): ERROR: thread attach failed
05-16 14:31:13.698: ERROR/ActivityThread(723): Failed to find provider info for com.google.settings
05-16 14:31:13.987: ERROR/AndroidRuntime(723): Uncaught handler: thread main exiting due to uncaught exception

Basically my code is:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    //connect to server

    //get current map scope

    //get media within map scope + a bit

    //init and show map
    setContentView(R.layout.main);
    //add zoom controls
    mapView = (MapView) findViewById(R.id.mapview);

    mapView.setBuiltInZoomControls(true); 


    //add menu
}

Exceptions:

05-16 15:13:05.204: ERROR/AndroidRuntime(726): java.lang.RuntimeException: Unable to start activity     ComponentInfo{org.diretto.client.smartphone.android/org.diretto.client.smartphone.android.AnDiretto}: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.os.Looper.loop(Looper.java:123)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread.main(ActivityThread.java:3948)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at java.lang.reflect.Method.invokeNative(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at java.lang.reflect.Method.invoke(Method.java:521)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at dalvik.system.NativeStart.main(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.createView(LayoutInflater.java:512)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.Activity.setContentView(Activity.java:1626)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at org.diretto.client.smartphone.android.AnDiretto.onCreate(AnDiretto.java:39)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     ... 11 more
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: java.lang.reflect.InvocationTargetException
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.google.android.maps.MapView.(MapView.java:237)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at android.view.LayoutInflater.createView(LayoutInflater.java:499)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     ... 21 more
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:180)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.google.android.maps.MapView开发者_开发百科.(MapView.java:279)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     at com.google.android.maps.MapView.(MapView.java:254)
05-16 15:13:05.204: ERROR/AndroidRuntime(726):     ... 25 more

XML file line 6 would be:

<com.google.android.maps.MapView android:id="@+id/mapview" ...

followed by other lines of XML-parameters


First, do not answer your own question unless you are truly providing an answer. You can edit your question to add new materials, such as your longer stack trace.

Your exception is:

Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity

This is because you are only allowed to have a single MapView in a MapActivity, and apparently you have two or more.


I know you are well past this issue, but I had the same issue, here are my notes about the same problem and how I was able to fix it.

You are only allowed to have a single MapView in a MapActivity

Delete a view and recreate it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜