Error while using Google Map API on Android emulator

excokedrinker

New Member
For past couple of days I have searched for a remedy by reading all possible tutorials for Google Maps. I get the following errors (issue might be with XML I guess):Error:\[code\]03-24 07:58:25.718: E/AndroidRuntime(968): FATAL EXCEPTION: main03-24 07:58:25.718: E/AndroidRuntime(968): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.finaltest/com.example.finaltest.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.maps.MapView03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread.access$600(ActivityThread.java:141)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)03-24 07:58:25.718: E/AndroidRuntime(968): at android.os.Handler.dispatchMessage(Handler.java:99)03-24 07:58:25.718: E/AndroidRuntime(968): at android.os.Looper.loop(Looper.java:137)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread.main(ActivityThread.java:5041)03-24 07:58:25.718: E/AndroidRuntime(968): at java.lang.reflect.Method.invokeNative(Native Method)03-24 07:58:25.718: E/AndroidRuntime(968): at java.lang.reflect.Method.invoke(Method.java:511)03-24 07:58:25.718: E/AndroidRuntime(968): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)03-24 07:58:25.718: E/AndroidRuntime(968): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)03-24 07:58:25.718: E/AndroidRuntime(968): at dalvik.system.NativeStart.main(Native Method)03-24 07:58:25.718: E/AndroidRuntime(968): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.maps.MapView03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.createView(LayoutInflater.java:613)03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)03-24 07:58:25.718: E/AndroidRuntime(968): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.Activity.setContentView(Activity.java:1881)03-24 07:58:25.718: E/AndroidRuntime(968): at com.example.finaltest.MainActivity.onCreate(MainActivity.java:12)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.Activity.performCreate(Activity.java:5104)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)03-24 07:58:25.718: E/AndroidRuntime(968): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)03-24 07:58:25.718: E/AndroidRuntime(968): ... 11 more03-24 07:58:25.718: E/AndroidRuntime(968): Caused by: java.lang.reflect.InvocationTargetException03-24 07:58:25.718: E/AndroidRuntime(968): at java.lang.reflect.Constructor.constructNative(Native Method)03-24 07:58:25.718: E/AndroidRuntime(968): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)03-24 07:58:25.718: E/AndroidRuntime(968): at android.view.LayoutInflater.createView(LayoutInflater.java:587)03-24 07:58:25.718: E/AndroidRuntime(968): ... 21 more03-24 07:58:25.718: E/AndroidRuntime(968): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.03-24 07:58:25.718: E/AndroidRuntime(968): at com.google.android.maps.MapView.<init>(MapView.java:291)03-24 07:58:25.718: E/AndroidRuntime(968): at com.google.android.maps.MapView.<init>(MapView.java:264)03-24 07:58:25.718: E/AndroidRuntime(968): at com.google.android.maps.MapView.<init>(MapView.java:247)03-24 07:58:25.718: E/AndroidRuntime(968): ... 24 more\[/code\]This is my main.xml\[code\]<?xml version="1.0" encoding="utf-8"?><com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myMapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="A*************************************E"/>\[/code\]I tried executing with fragment instead of Mapview and it still didn't execute. I have added all libraries and permissions to my manifest.PS: I'm running on an emulator
 
Back
Top