実際のデバイスでアプリケーションを実行すると、このエラーが発生します。
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);*/
}
}
これは私のメインフェストファイルです。
<?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 my 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>
アプリに必要な Google Play ライブラリをインポートしました。マップ オブジェクトが null ではありません。しかし、logcat には「Google maps Api v2 Failed to load map. Could not connect to google servers」と表示されます。
私は何が欠けていますか?誰か助けてください!! これは私を殺している !