android - Google maps api v2. Failed to Load Map. Could not connect to google servers -
i getting error when run application on real device.
main_activity.java,
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); int chkgoogleplayservices = googleplayservicesutil .isgoogleplayservicesavailable(context); if (chkgoogleplayservices != connectionresult.success) { googleplayservicesutil.geterrordialog(chkgoogleplayservices, (activity) context, 1122).show(); } else { supportmapfragment sfm = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mmap = sfm.getmap(); mmap.setmaptype(googlemap.map_type_normal); lm = (locationmanager) getsystemservice(context.location_service); criteria criteria = new criteria(); criteria.setaccuracy(criteria.accuracy_fine); // location update locationlistener listener = new locationlistener() { @override public void onlocationchanged(location location) { mmap.clear(); final cameraposition cameraposition = new cameraposition.builder() .target(new latlng(location.getlatitude(), location .getlongitude())).zoom(14.0f).build(); final cameraupdate cameraupdate = cameraupdatefactory .newcameraposition(cameraposition); mmap.movecamera(cameraupdate); } alertdialog.builder dialog = new alertdialog.builder(context) .settitle(r.string.remindenablegps); alertdialog alert = dialog.create(); @override public void onproviderdisabled(string provider) { alert.setcanceledontouchoutside(false); alert.setcancelable(true); alert.show(); } @override public void onproviderenabled(string provider) { alert.dismiss(); } @override public void onstatuschanged(string provider, int status, bundle extras) { } }; lm.requestlocationupdates(locationmanager.gps_provider, 0, 0, listener); final location mlocation = lm .getlastknownlocation(locationmanager.gps_provider); /*final cameraposition cameraposition = new cameraposition.builder() .target(new latlng(mlocation.getlatitude(), mlocation .getlongitude())).zoom(14.0f).build(); final cameraupdate cameraupdate = cameraupdatefactory .newcameraposition(cameraposition); mmap.movecamera(cameraupdate);*/ } }
this mainifest file,
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.findproperty" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="10" /> <permission android:name="com.example.findproperty.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com.example.findproperty.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_network_state" /> <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.findproperty.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> <uses-library android:name="com.google.android.maps" /> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="given signed key" /> </application> </manifest>
activity_main.xml,
<?xml version="1.0"?>
<fragment android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginbottom="30dp" android:layout_marginleft="30dp" android:layout_marginright="30dp" android:layout_margintop="60dp" class="com.google.android.gms.maps.supportmapfragment" android:clickable="true" /> </relativelayout>
i have imported google play libraries required app. map object not null. in logcat displays "google maps api v2 failed load map. not connect google servers"
what missing? please help!! killing me!!
your manifest implies have entered signed api key google api key, assume you're testing installing signed apk on device , not running app signed debug key via eclipse. correct?
problems api access come down input error api key, or error during hashing process.
i make sure key in manifest correct.