Reputation: 133
Hi i am trying to run a map application using the code provided by google but the map not displaying,it displayed for yesterday now a blank screen is showing on my device
When i run the program the following is the log
LogCat
01-02 11:33:36.203: D/dalvikvm(20623): GC_CONCURRENT freed 188K, 10% free 7589K/8391K, paused 17ms+10ms, total 86ms
01-02 11:33:36.203: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 43ms
01-02 11:33:36.789: D/dalvikvm(20623): GC_CONCURRENT freed 343K, 11% free 7817K/8775K, paused 12ms+2ms, total 68ms
01-02 11:33:36.789: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 31ms
01-02 11:33:36.789: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 31ms
01-02 11:33:36.789: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 31ms
01-02 11:33:36.789: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 32ms
01-02 11:33:36.789: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 33ms
01-02 11:33:36.796: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 36ms
01-02 11:33:36.937: D/AbsListView(20623): Get MotionRecognitionManager
01-02 11:33:37.007: D/dalvikvm(20623): GC_CONCURRENT freed 255K, 11% free 8050K/8967K, paused 17ms+3ms, total 59ms
01-02 11:33:37.039: E/GooglePlayServicesUtil(20623): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-02 11:33:37.109: D/libEGL(20623): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
01-02 11:33:37.125: D/libEGL(20623): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
01-02 11:33:37.132: D/libEGL(20623): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
01-02 11:33:37.242: D/OpenGLRenderer(20623): Enabling debug mode 0
01-02 11:33:37.492: D/dalvikvm(20623): GC_FOR_ALLOC freed 267K, 11% free 8188K/9159K, paused 35ms, total 35ms
01-02 11:33:37.539: D/dalvikvm(20623): GC_CONCURRENT freed 327K, 12% free 8318K/9351K, paused 3ms+2ms, total 32ms
01-02 11:33:37.539: D/dalvikvm(20623): WAIT_FOR_CONCURRENT_GC blocked 20ms
01-02 11:33:37.570: D/dalvikvm(20623): GC_FOR_ALLOC freed 453K, 13% free 8191K/9351K, paused 21ms, total 21ms
01-02 11:33:37.679: D/dalvikvm(20623): GC_CONCURRENT freed 304K, 11% free 8335K/9351K, paused 17ms+40ms, total 105ms
It is showing google play service not installed.But i installed the play service and imported it to my eclipse workspace and the i added it to my project using
project-properties-android
This is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googlemap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.googlemap.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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-permission android:name="com.googlemap.permission.MAPS_RECEIVE" />
<application
android:allowBackup="true"
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="com.googlemap.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="My api key"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
xml file
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
MainActivity.java
package com.googlemap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends FragmentActivity {
GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (map == null) {
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
LatLng loc = new LatLng(8.557845, 76.880727);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 13));
map.addMarker(new MarkerOptions()
.title("Google map")
.snippet(" IT city .")
.position(loc));
}
}
}
project.properties file
target=Google Inc.:Google APIs:17
android.library=false
android.library.reference.1=../google-play-services_lib
Please help me.i have tried some solution but i am not getting the result Thanks in advance..
Upvotes: 1
Views: 911
Reputation: 21551
See here,just change the api key with your key in manifest file and follow these steps: and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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.geeklabs.map.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="replace with your API key"/>
</application>
</manifest>
MainActivity.java:
package com.geeklabs.map;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
After got this let me know.
Upvotes: 1
Reputation: 133560
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Looks like you have not setup google play services properly.
Follow the steps in the below link and setup google play services.
http://developer.android.com/google/play-services/setup.html
You also need to check the availability of google play services. Check the topic Check for Google Play Services in the below link.
http://developer.android.com/training/location/receive-location-updates.html
Your min sdk is 14
<uses-sdk
android:minSdkVersion="14"
So you need to use MapFragment
instead of SupportMapFrament
.
Change to
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
Replace
public class MainActivity extends FragmentActivity {
By
public class MainActivity extends Activity {
Change
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
to
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Upvotes: 2