How To Display Google Map in android emulator?I tried this program in google AVD in android

Here is my code to display the google map in my android emulator using google AVD.... How to fix this problem?anybody can know this?

Map.java:

public class MapsActivity extends MapActivity { private MapView mapView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mapView = (MapView) findViewById(R.id.mapView); mapView.setBuiltInZoomControls(true); } @Override protected boolean isRouteDisplayed() { return false; }

Xml File:

<com.google.android.maps.MapView android:id="@+id/mapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ" > </com.google.android.maps.MapView>

Manifost File:

<category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET" /> <uses-library android:name="com.google.android.maps" />

Output: In my emulator map activity has stopped unexpexctly.. i got the runtime exception

01-04 10:36:24.540: D/dalvikvm(641): Not late-enabling CheckJNI (already on) 01-04 10:36:25.290: W/dalvikvm(641): Unable to resolve superclass of Lcom/example/MapsActivity; (10) 01-04 10:36:25.290: W/dalvikvm(641): Link of class 'Lcom/example/MapsActivity;' failed 01-04 10:36:25.290: D/AndroidRuntime(641): Shutting down VM 01-04 10:36:25.290: W/dalvikvm(641): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 01-04 10:36:25.430: E/AndroidRuntime(641): FATAL EXCEPTION: main 01-04 10:36:25.430: E/AndroidRuntime(641): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.os.Looper.loop(Looper.java:137) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 10:36:25.430: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-04 10:36:25.430: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-04 10:36:25.430: E/AndroidRuntime(641): at dalvik.system.NativeStart.main(Native Method) 01-04 10:36:25.430: E/AndroidRuntime(641): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:36:25.430: E/AndroidRuntime(641): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 01-04 10:36:25.430: E/AndroidRuntime(641): ... 11 more 01-04 10:36:31.140: W/dalvikvm(679): Unable to resolve superclass of Lcom/example/MapsActivity; (10) 01-04 10:36:31.160: W/dalvikvm(679): Link of class 'Lcom/example/MapsActivity;' failed 01-04 10:36:31.160: D/AndroidRuntime(679): Shutting down VM 01-04 10:36:31.180: W/dalvikvm(679): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 01-04 10:36:31.240: E/AndroidRuntime(679): FATAL EXCEPTION: main 01-04 10:36:31.240: E/AndroidRuntime(679): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:137) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 10:36:31.240: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-04 10:36:31.240: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-04 10:36:31.240: E/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method) 01-04 10:36:31.240: E/AndroidRuntime(679): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:36:31.240: E/AndroidRuntime(679): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 01-04 10:36:31.240: E/AndroidRuntime(679): ... 11 more 01-04 10:37:23.619: W/dalvikvm(720): Unable to resolve superclass of Lcom/example/MapsActivity; (10) 01-04 10:37:23.659: W/dalvikvm(720): Link of class 'Lcom/example/MapsActivity;' failed 01-04 10:37:23.659: D/AndroidRuntime(720): Shutting down VM 01-04 10:37:23.669: W/dalvikvm(720): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 01-04 10:37:23.699: E/AndroidRuntime(720): FATAL EXCEPTION: main 01-04 10:37:23.699: E/AndroidRuntime(720): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.os.Looper.loop(Looper.java:137) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 10:37:23.699: E/AndroidRuntime(720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-04 10:37:23.699: E/AndroidRuntime(720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-04 10:37:23.699: E/AndroidRuntime(720): at dalvik.system.NativeStart.main(Native Method) 01-04 10:37:23.699: E/AndroidRuntime(720): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity 01-04 10:37:23.699: E/AndroidRuntime(720): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 01-04 10:37:23.699: E/AndroidRuntime(720): ... 11 more

Output screen:

google map view screen shot

-------------Problems Reply------------

Your mentioned code is right But i have two doubt is that

1. Google MAP API

Ans .To get Google MAP API Here

2. Check Emulator's Internet.

Ans . Open CMD D:\SOFTWARE\Android-SDK\android-sdk-2.2>emulator -avd avdname -dns-server 8.8.8.8

I think problem with your API key only. Any how check the link below you will get an idea.

Displaying Google maps in Android Emulator

I found one thing in your manifest, you written

<uses-library android:name="com.google.android.maps" />

after </application> i think it may wrong

In manifest file write as below and try once

<application
<uses-library android:name="com.google.android.maps" />

New Answer

Please check this link, it may help you. Enable internet for Android Emulator

add google maps library in your manifest and it should work

Move :

<uses-library android:name="com.google.android.maps" />

within the application tag. You have written outside the application tag in manifest file.

For your second problem: I am sure you have copied the map key from some where else. This is causing only blank screen on emulator. Try to generate your own Map Key following:

http://code.google.com/android/add-ons/google-apis/mapkey.html

http://mobiforge.com/developing/story/using-google-maps-android please visit this site and replace your Api key. it will perfectly work :-)

Are you using the same pc from where you generate your Api key?

the error class not found exception is when actitvity is not declared in manifest if you have declared it and then also error comes please please check you may have included a jar file twice in your project

Category:android Views:0 Time:2012-01-04

Related post

  • Google Maps API geocoder (V3), how to set language on google.maps.GeocoderResult 2011-07-08

    Is there any property that I can use in Google Maps geocoder (V3) to dynamically set language in result (google.maps.GeocoderResult)?. Not using html header scrip tag <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=fa

  • How do I display a Simple Google Map in my emulator in android? 2010-11-29

    I tried to write a simple google map application to display simple map but doesn't give me any output. I pasted my code below: AnroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/

  • Google Maps Test on Emulator 2013-06-06

    Hi everyone! I create a simple Google Maps with JavaScript API v3 on localhost. The problem when I test my map on Emulator (using Google Nexus One profile for example) is: the map always moves down even I holds and drags my mouse on the other side. A

  • Google Maps API: Adding letters to my markers on my google map 2010-08-09

    I'm trying to add a letter to my marker and then have multiple markers (14 to be accurate) with letters. l have so far done this without success. I'm a complete novice with code and google API. Can you tell what code l need to add and where? Below is

  • How can I use Google Map Feed API to get a list of my Google Maps using Python? 2011-08-29

    I want to create a script in Python which downloads the current KML files of all the Maps I created on Google Maps. To do so manually, I can use this: http://maps.google.com.br/maps/ms?msid=USER_ID.MAP_ID&msa=0&output=kml where USER_ID is a c

  • google-maps-api-3 - how to parse JSON output from Google Maps API distance matrix to PHP 2012-04-20

    i'm new to js and json with minimal php experience - i just want to get the output from google maps api - distance matrix back into php for further processing. i can't figure out how to get the distance value back into a variable in the following url

  • Android Emulator (API level 8) - just black screen after intro ANDROID message 2012-01-01

    I tried to start the emulator for API level 8, and it just shows a black screen after the ANDROID intro flashes. I get the following error messages in the DDMS: 01-01 17:56:51.315: E/System(120): Failure starting core service 01-01 17:56:51.315: E/Sy

  • Unable to open google map in android emulator's 2011-03-11

    In Android Emulator i am getting below Logcat Error: 03-11 04:44:56.663: ERROR/AndroidRuntime(403): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.map/com.map.MapDemo}: java.lang.ClassNotFoundException: com.map.MapDemo i

  • How to use Google map in Android emulator? 2011-08-29

    I'm trying to display the Google map on my Emulator. I'm using 2.2 (Google Inc). I'm having all the functions for displaying the map. But, it shows the error about [2011-08-29 13:27:49 - GoogleMaps] Could not find GoogleMaps.apk What can i do for thi

  • google map on Android Emulator Behind Proxy 2011-11-24

    I m facing the problem of accessing Maps of Android Emulator. I am working on Android emulator 2.3.1 (Google API) API 9. The problem is i am working behind corporate proxy. Emulator doesnt allowed to open Google Maps. It gives error : this applicatio

  • To Display the Google map on the emmulator 2011-02-24

    Now I am working on the Google maps API. I am not able to display the map on the emulator as well as the device......... how can i dis play the map. I tried like this but i failed... I searched for the debug.keystore in c:/ i found it. I got Keytool.

  • Is maps api key required for Geocoder to work on Android emulator 2011-03-05

    I am making an activity which tries to print the current location of the user given coordinates using geocoder, however it crashes whenever it calls getFromLocation. I have not put the maps key anywhere. I would like to know whether this is the main

  • google maps not displaying 2011-07-01

    In my application I want to display the maps. But its not displaying i don't know why it behaves. Actually first I got the API by running cmd in cmd prompt like this. First I went to the c:\program files\java\jdk1.6.0\bin>keytool.exe -list -alias

  • how to put Search on Google map in Android? 2010-01-19

    i am looking to put search on google map in android application can any one guide me how to achive this??? and want to display some text along with that perticular search location. any help would be appriciated. --------------Solutions------------- a

  • Open local KML File in Google Maps on Android 2010-05-28

    I have loaded a KML file onto an Android device. What's the easiest mechanism for loading an overlay of that KML file into Google Maps? I do not want to upload the KML file to the web but would rather open it locally. --------------Solutions---------

  • google maps using phonegap in android 2011-06-14

    I want to display the maps in android using phonegap. I copied the code shown in http://wiki.phonegap.com/w/page/16494764/PhoneGap-Geolocation-Sample-Application. I am using phonegap.0.9.4 and android emulator 2.2. I tested the application in android

  • Google Map Traffic Overlay on Android Device 2011-07-02

    I am currently doing an android project that shows live traffic congestion report. I am a newbie in Android Dev. I successfully deplayed Google map on my emulator. I also did some overlay control. I would like to do something like Google did, highlig

  • Google Map + phonegap in android 2011-08-11

    I want to implement Google Maps on android using phonegap and jquery. I have followed this The below script is unable to load on android emulator. Even though I have increased the time to 6 min. If i have commented out the below script, i an able to

  • How to display terrain view of google map in android2.2 application? 2011-12-16

    I am using google maps in my android2.2 application. In com.google.android.maps.MapView class i found only 2 views satellite view and street view. But, when i am browsing google maps i found terrain as one more view offered when we are displaying map

  • How can i get the user current location and put marker on it in android by using google maps 2012-03-13

    i develop the application that has Google API so i can put map in my app i have problem in get user Current location, i want : when the user open map Activity it display the map and marker on her location.i already doing google API stuff but i faced

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.186 (s). 11 q(s)