0

I am trying my 1st google maps app. and i followed all the steps in tutorial of vogella http://www.vogella.com/articles/AndroidGoogleMaps/article.html.

I created a api key and used the same in manifest file.

Declared all the permissions in manifest file.

While i run on phone, app works fine but when i try to run on emulator i get only empty screen with zoom-icons and in error console i get

06-25 06:06:54.387: E/Google Maps Android API(7808): Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above

I am trying to run on emulator with google api 4.2.2.

Manifest file

 <permission
        android:name="com.sample.maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

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

    <uses-permission android:name="com.sample.maps.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />  



    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.sample.maps.Presentlocation"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.maps" />
         <meta-data
            android:name="com.google.android.maps.v2.API_KEY" 
            android:value="AIzaSyD0Ku3-ysyNupHy59CtfvX6Cfmz_ob0pkk"/> 
    </application>

XML file

<fragment

          android:id="@+id/map" 
          android:layout_width="match_parent"
          android:layout_height="match_parent" 
          android:name="com.google.android.gms.maps.MapFragment"

         />

Java file

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.presentlocation);
}

Whats the mistake i am doing?

Thanks:)

Beginner
  • 1,414
  • 2
  • 21
  • 41
  • as the message in the logcat says you need to test your app on a real device then supports OpenGL ES 2.0 – Raghunandan Jun 25 '13 at 06:18
  • @Raghunandan No way to test on emulator???.. i looked into many answers on SO.. saying like you can run on emulator by installing com.google.android.gms.apk and com.android.vending.apk. but when i tried to install i got an error saying it already exists – Beginner Jun 25 '13 at 06:21
  • you can there is a workaround but i would suggest you to test it on a real device. – Raghunandan Jun 25 '13 at 06:22
  • http://blog-emildesign.rhcloud.com/?p=527. here's the blog by emil adz. might help although i have not testes it. read the comment section also including the last one. – Raghunandan Jun 25 '13 at 06:23

4 Answers4

2

The default ARM emulator for Android does not have OpenGL ES 2.0 support which is required by Google maps. You need to get the x86 emulators. They support this feature and Google maps should run fine on those.

How to set up x86 emulator: https://stackoverflow.com/a/13856866/1369222

official docs on hardware acceleration: https://developer.android.com/tools/devices/emulator.html#acceleration

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
0

You need to give latitude and longitude to the device using DDMS -> Emulator Control.

Prachi
  • 3,584
  • 2
  • 24
  • 39
0

You need to give latitude and longitude to the device using DDMS -> Emulator Control. And for maps v1, to display the map we need to sign the apk with the keystore with which the API is retreived.

0

since june 2013 a lot has changed. we dont need to install apks on the emulator. The sample in ..\Android\android-studio\sdk\extras\google\google_play_services\samples\maps works (with a few minor tweaks below) and provides examples for a lot of things that one might want to do.

the weaks: A. in the manifest, the key needed is a browser key, not an app key:

B. the versions need to be updated (currently 21) C. if running Windows, make sure to install the latest Intel HAEM and start an AVD using Google APIs D. import the sample project into Android Studio. if it misses meta-data it will tell you how it looks like and where to add it.

Build, run, enjoy the dozen or so samples. Voila!

krazyk4tlady
  • 389
  • 1
  • 5
  • 13