昨天我更新了我的日食。在我更新 eclipse 之前,我的应用程序运行正确,但是在我运行应用程序时更新了 eclipse 之后,我有一个错误,
我的日志猫
E/AndroidRuntime(2161): ... 11 more 11-02 04:50:32.609: E/AndroidRuntime(2161): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not有正确的价值。预期为 4030500,但发现为 0。您必须在元素中具有以下声明:11-02 04:50:32.609: E/AndroidRuntime(2161): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 11-02 04:50:32.609:E/AndroidRuntime(2161):在 com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(未知来源)11-02 04:50:32.609:E/AndroidRuntime(2161):在 com.google.android.gms.maps.internal.qv(未知来源)11-02 04:50:32.609:E/AndroidRuntime(2161):在 com.google.android.gms.maps.internal.qu(未知来源)11-02 04:50:32.609: E/AndroidRuntime(2161): 在 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676) 11-02 04:50:32.609: E/AndroidRuntime(2161): ... 21 更多 11-02 04:50: 45.858:I/Process(2161):发送信号。PID:2161 SIG:9
我的活动.java
package org.lucasr.twowayview;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
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 android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Menu;
public class MainMapActivity extends FragmentActivity
{
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_map);
setupMapIfNeeded();
}
private void setupMapIfNeeded()
{
if(map == null)
{
FragmentManager fragmentManager = getSupportFragmentManager();
SupportMapFragment supportMapFragment = (SupportMapFragment) fragmentManager.findFragmentById(R.id.maps);
map = supportMapFragment.getMap();
if(map != null)
{
setupMap();
}
}
}
private void setupMap()
{
map.setMyLocationEnabled(true);
moveToMyLocation();
}
private void moveToMyLocation()
{
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
if ( location != null)
{
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13));
}
}
@Override public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_map, menu);
return true;
}
protected void onResume()
{
super.onResume();
int resCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if( resCode != ConnectionResult.SUCCESS)
{
GooglePlayServicesUtil.getErrorDialog(resCode, this, 1);
}
}
}
清单.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vindypratama.tempatwisata"
android:versionCode="1"
android:versionName="1.0" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<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="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.vindypratama.tempatwisata.permission.MAPS_RECEIVE" />
<permission
android:name="com.vindypratama.tempatwisata.permission.MAPS_RECEIVE"
android:protectionLevel="signature" >
</permission><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" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDcosD0fQsQcYCEiDDkRxP6ZRACPf-svaw" />
<activity
android:name="com.vindypratama.tempatwisata.MainMapActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application><manifest>
</manifest>
xml文件:
<fragment android:id="@+id/maps" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" />