ios developer
ios developer

Reputation: 3473

Android+Sample application of google Map

I am new to android.I want to make application which displays the map when application start. I had gone all the steps this

I had installed the Google API and and done all the setting in eclipse.But in output it is only gray grids and also get error Couldn't get connection factory client The question may be duplicate of this: Google Map not showing in android Emulator

But the solution of using JDK.The person is using JDK 7 instead of JDK6. How to adjust this JDK from eclipse menu.

MainActivity.Menifest file is:

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

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


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

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

and .xml file is:

<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" >

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

</RelativeLayout>

And .java file is:

package com.siliconinfo.googlemaps;

import android.os.Bundle;
//import android.view.Menu;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;


public class MapsActivity extends MapActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainactivity);
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}

But then also it is not showing any map on screen warning on console:-GoogleMaps does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner in its AndroidManifest.xml

Upvotes: 0

Views: 427

Answers (2)

ios developer
ios developer

Reputation: 3473

Thanks for the Reply.I got the MAp display in emulater By making setting in AVD manager.By setting API level at 13. IT works for me.Thanks to all for helping me trying to solve the issue and giving me more knowledge while solving this issue

Upvotes: 0

user1640247
user1640247

Reputation: 72

Sometimes it may problem with Api key. Try again to generate api key by using MD5 .

Adjusting Jdk:

Project...Properties...Java Compiler----JDK Compliance

You can change there

Upvotes: 1

Related Questions