0
我有問題,我嘗試使克里特應用程序的Android。但是當我跑步時我的應用程序有問題,這樣的E/AndroidRuntime(29668):java.lang.RuntimeException:無法啓動活動ComponentInfo {錯誤膨脹類片段
11-14 19:36:51.989: W/dalvikvm(29668): VFY: unable to resolve virtual method 292: Landroid/app/Notification$Builder;.setPriority (I)Landroid/app/Notification$Builder;
11-14 19:36:51.989: W/dalvikvm(29668): threadid=1: thread exiting with uncaught exception (group=0x40b019f0)
11-14 19:36:51.999: E/AndroidRuntime(29668): FATAL EXCEPTION: main
11-14 19:36:51.999: E/AndroidRuntime(29668): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fuad.traffic/com.fuad.traffic.MainActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.os.Looper.loop(Looper.java:137)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-14 19:36:51.999: E/AndroidRuntime(29668): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 19:36:51.999: E/AndroidRuntime(29668): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
11-14 19:36:51.999: E/AndroidRuntime(29668): at dalvik.system.NativeStart.main(Native Method)
11-14 19:36:51.999: E/AndroidRuntime(29668): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:268)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.Activity.setContentView(Activity.java:1837)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.fuad.traffic.MainActivity.onCreate(MainActivity.java:15)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.Activity.performCreate(Activity.java:4470)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-14 19:36:51.999: E/AndroidRuntime(29668): ... 11 more
11-14 19:36:51.999: E/AndroidRuntime(29668): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 6111000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.common.GooglePlayServicesUtil.E(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.internal.u.S(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.internal.u.R(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.SupportMapFragment$b.my(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2158)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
11-14 19:36:51.999: E/AndroidRuntime(29668): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
11-14 19:36:51.999: E/AndroidRuntime(29668): ... 21 more
這是我的代碼mainactivity.java
package com.fuad.traffic;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.Menu;
//import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@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, menu);
return true;
}
/**@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}*/
}
ANF這是我的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fuad.traffic"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.fuad.traffic"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="com.fuad.traffic"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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-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=".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="AIzaSyA_5aZyzrTpGcKuigTrCZcjK6TZ2MU4Glc"/>
</application>
</manifest>
這是用於mainactivity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.fuad.traffic.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:layout_height="match_parent"
android:layout_width="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
thanx的主人在stackoveflow,請幫我
感謝名單計算器
,該elemet <元數據機器人:名字= 「com.google.android.gms.version」 機器人:值= 「@整數/ GOOGLE_PLAY_SERVICES_VERSION」> 和你在Android介意:值apikey?或只是它,就像你寫的? – user3001890 2014-11-14 14:30:45
不是api鍵。就像我寫的那樣給它。如果您已正確導入谷歌播放服務,它將起作用。 – 2014-11-14 14:59:49
我有導入像你的寫,但沒有運行agin,仍然喜歡它,沒有運行,並有eror和eror仍然相同,首先。 – user3001890 2014-11-14 15:19:28