昨天我更新了我的日食。在我更新eclipse之前,我的应用程序运行正常但是在我运行应用程序后更新了eclipse之后,我出错了,
我的LOGCAT
11-02 04:50:32.548:D / AndroidRuntime(2161):关闭VM 11-02 04:50:32.548:W / dalvikvm(2161):threadid = 1:线程退出 未捕获的异常(组= 0x40a71930)11-02 04:50:32.609: E / AndroidRuntime(2161):致命异常:主11-02 04:50:32.609: E / AndroidRuntime(2161):java.lang.RuntimeException:无法启动 活动 ComponentInfo {com.vindypratama.tempatwisata / com.vindypratama.tempatwisata.MainMapActivity}: android.view.InflateException:二进制XML文件行#7:错误 inflating class fragment 11-02 04:50:32.609:E / AndroidRuntime(2161): 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.ActivityThread.access $ 600(ActivityThread.java:141)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1234) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.os.Handler.dispatchMessage(Handler.java:99)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.os.Looper.loop(Looper.java:137)11-02 04:50:32.609: E / AndroidRuntime(2161):at android.app.ActivityThread.main(ActivityThread.java:5041)11-02 04:50:32.609:E / AndroidRuntime(2161):at java.lang.reflect.Method.invokeNative(Native Method)11-02 04:50:32.609:E / AndroidRuntime(2161):at java.lang.reflect.Method.invoke(Method.java:511)11-02 04:50:32.609: E / AndroidRuntime(2161):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793) 11-02 04:50:32.609:E / AndroidRuntime(2161):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)11-02 04:50:32.609:E / AndroidRuntime(2161):at dalvik.system.NativeStart.main(Native Method)11-02 04:50:32.609: E / AndroidRuntime(2161):引起:android.view.InflateException: 二进制XML文件行#7:错误膨胀类片段11-02 04:50:32.609:E / AndroidRuntime(2161):at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.view.LayoutInflater.inflate(LayoutInflater.java:489)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.view.LayoutInflater.inflate(LayoutInflater.java:396)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.view.LayoutInflater.inflate(LayoutInflater.java:352)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.Activity.setContentView(Activity.java:1881)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.vindypratama.tempatwisata.MainMapActivity.onCreate(MainMapActivity.java:25) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.Activity.performCreate(Activity.java:5104)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 11-02 04:50:32.609:E / AndroidRuntime(2161):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 11-02 04:50:32.609:E / AndroidRuntime(2161):... 11更多11-02 04:50:32.609:E / AndroidRuntime(2161):引起: java.lang.IllegalStateException:应用程序中的元数据标记 AndroidManifest.xml没有正确的值。预计4030500 但是找到了0.你必须在其中有以下声明 元素:11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.common.GooglePlayServicesUtil.n(未知来源) 11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(未知 来源)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.internal.q.v(未知来源)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.internal.q.u(Unknown Source)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.MapsInitializer.initialize(未知来源) 11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.SupportMapFragment $ b.cE(未知来源) 11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.SupportMapFragment $ b.a(未知来源) 11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.dynamic.a.a(Unknown Source)11-02 04:50:32.609: E / AndroidRuntime(2161):at com.google.android.gms.dynamic.a.onInflate(Unknown Source)11-02 04:50:32.609:E / AndroidRuntime(2161):at com.google.android.gms.maps.SupportMapFragment.onInflate(未知 来源)11-02 04:50:32.609:E / AndroidRuntime(2161):at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290) 11-02 04:50:32.609:E / AndroidRuntime(2161):at 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
我的activity.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);
}
}
}
Manifest.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" />
答案 0 :(得分:0)
尝试使用Project -> Clean
。这实际上帮助了我。Clean
之后启动Eclipse。
答案 1 :(得分:-1)
您正在使用自定义类 - twowayview。修复你构建路径。检查您是否已在构建路径中检查添加的jar。清理项目。删除bin folder.clear /刷新项目。它会起作用