2

I want to add google map in my android app. After following all the steps and removing exceptions such as "inflating class fragment", my AVD is now showing This app won't work unless you update Google play services. I tried to update Google play services through the following steps

Right click on Project > Android Tools > Add Support Library

But got 2 error messages.

    [2013-08-08 09:36:00 - SDK Manager]   Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Connection to http://10.10.10.100:8080 refused
[2013-08-08 09:37:45 - SDK Manager]   Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-8.xml, reason: HttpHostConnect Connection to http://10.10.10.100:8080 refused

I am using the emulator Eclipse version 4.2.0
manifest.xml file is attached here

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

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

        <uses-permission android:name="com.example.newapp.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" />
        <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.newapp.NewApp"
            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="*********************************" />
           </application>

</manifest>

activity_new_app.xml

   <RelativeLayout 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=".NewApp" >


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

</RelativeLayout

> NewApp.java

package com.example.newapp;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class NewApp extends FragmentActivity {

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

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

}

Please give me any suggestion.

Inzimam Tariq IT
  • 6,548
  • 8
  • 42
  • 69
maria
  • 53
  • 1
  • 14
  • Latest versions of Google Maps can't be run in emulator as it doesn't have Google Play services installed. – Spring Breaker Aug 08 '13 at 05:41
  • @user2012, But Google map is available as a separate application in my emulator. – maria Aug 08 '13 at 06:12
  • :To run v2 Map, **Google Play Services** must be installed not Google Map. – Spring Breaker Aug 08 '13 at 06:20
  • possible duplicate of [This app won't run unless you update Google Play Services. (via Bazaar)](http://stackoverflow.com/questions/13691943/this-app-wont-run-unless-you-update-google-play-services-via-bazaar) – rptwsthi Sep 20 '13 at 12:58

1 Answers1

2

Google Android Map Api v2 doc says,you can't run google maps v2 on Android emulator. You must use a device for your tests. But some people suggest it can be done by installing the required services like Google Play Services in the emulator. See the various answers of the following post, you will get some clue.

Running Google Maps v2 on the Android emulator

Community
  • 1
  • 1
Spring Breaker
  • 8,233
  • 3
  • 36
  • 60