3

I implemented Google Map using v2 Version . i tested app on real device . it is working fine , but i want to test it on emulator also . How can i do that ?

Here is my manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.demogooglemapv2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="17" />

<permission
         android:name="com.example.demogooglemapv2.permission.MAPS_RECEIVE"
         android:protectionLevel="signature"/>

<uses-permission  android:name="com.example.demogooglemapv2.permission.MAPS_RECEIVE"/>


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

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

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




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


        <activity
            android:name="com.example.demogooglemapv2.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <meta-data 
           android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyB2jvxyj-WbkYc1Y1WR9Sc1E1W22QywA_k"
            />
    </application>

</manifest>

Here is my activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >



    <fragment 
         class="com.google.android.gms.maps.SupportMapFragment"
        android:id="@+id/map"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        />



</LinearLayout>

Here is my mainActivity.java

package com.example.demogooglemapv2;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;

import android.os.Bundle;
import android.app.Activity;

import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends FragmentActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

          if (resultCode == ConnectionResult.SUCCESS){
           Toast.makeText(getApplicationContext(), 
             "isGooglePlayServicesAvailable SUCCESS", 
             Toast.LENGTH_LONG).show();
          }else{

          }




    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();

        int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

          if (resultCode == ConnectionResult.SUCCESS){
           Toast.makeText(getApplicationContext(), 
             "isGooglePlayServicesAvailable SUCCESS", 
             Toast.LENGTH_LONG).show();

           Log.v(">>>>>>>>>>>>>.", "successs");
          }else{

          }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}
shweta_jain
  • 453
  • 1
  • 5
  • 19

5 Answers5

3

Google map api 2 doesn't support to run in android. it Refer this and but it is possible that you can install some apk to emulator to access google map api v2 in emulator for that see here

Community
  • 1
  • 1
Nas
  • 2,158
  • 1
  • 21
  • 38
  • i follow this link .. but i did not get any solution .. when i try to push vending.apk . an error occured " no more space in device " now how i solv this problem – shweta_jain Jul 15 '13 at 09:53
  • Its due to less storage available in emulator.uninstall useless apps that you installed in your emulator and increase your internal storage memory by editing your emulator in AVD manager. – Nas Jul 15 '13 at 10:10
  • I change internal storage to 768 MB .. But still same problem .. Please suggess me – shweta_jain Jul 15 '13 at 10:44
  • try this http://stackoverflow.com/questions/2239330/how-to-increase-storage-for-android-emulator-install-failed-insufficient-stora/8073234#8073234 – Nas Jul 15 '13 at 12:09
  • are u changing the Ram memory size? You need to change your internal storage memory. – Nas Jul 15 '13 at 12:16
3

I have stucked on this problem a long time too. I don't have one android device to use, so i have to tried on emulator.

The best way i found to make the map work on the emulator is use another emulator instead of eclipse emulator.

Search for Genymotion. Is the best emulator i've tried. You can download any app with google play, and the maps work fine on this.

Sorry for my bad english.

Bruno Pinto
  • 2,013
  • 3
  • 23
  • 33
3

Look at my answer on this post , have a tutorial to do the map v2 working on android emulator.

Or just look for genymotion.

Community
  • 1
  • 1
Bruno Pinto
  • 2,013
  • 3
  • 23
  • 33
1

Its Working Fine in My Case.

I have added this code inside application tag in Manifest

<meta-data
        android:name="com.google.android.gms.version"
        android:value="4242000" />
0

You just can't. Emulator doesn't support maps V2 at the moment.

Stephane Mathis
  • 6,542
  • 6
  • 43
  • 69