应用程序启动时出现此错误
我收到了主题中显示的许多类型的错误。这些错误似乎是偶然的,我无法重现它们。从堆栈中我可以了解到,我的不同布局资源可能会发生此类错误。XML 的行也各不相同。
谁能解释为什么会发生此错误?我能做些什么来解决这个问题?
09-06 00:15:33.254: E/AndroidRuntime(7812): FATAL EXCEPTION: main
09-06 00:15:33.254: E/AndroidRuntime(7812): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.touchboarder.example.videostream/com.touchboarder.example.videostream.Activity_Mapa}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread.access$600(ActivityThread.java:140)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.os.Handler.dispatchMessage(Handler.java:99)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.os.Looper.loop(Looper.java:137)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread.main(ActivityThread.java:4898)
09-06 00:15:33.254: E/AndroidRuntime(7812): at java.lang.reflect.Method.invokeNative(Native Method)
09-06 00:15:33.254: E/AndroidRuntime(7812): at java.lang.reflect.Method.invoke(Method.java:511)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
09-06 00:15:33.254: E/AndroidRuntime(7812): at dalvik.system.NativeStart.main(Native Method)
09-06 00:15:33.254: E/AndroidRuntime(7812): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:308)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.Activity.setContentView(Activity.java:1924)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.touchboarder.example.videostream.Activity_Mapa.onCreate(Activity_Mapa.java:59)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.Activity.performCreate(Activity.java:5206)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
09-06 00:15:33.254: E/AndroidRuntime(7812): ... 11 more
09-06 00:15:33.254: E/AndroidRuntime(7812): Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
09-06 00:15:33.254: E/AndroidRuntime(7812): at maps.ag.bb.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at maps.ag.bb.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at maps.ag.an.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at maps.ag.bi.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at maps.ag.bh.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at blf.onTransact(SourceFile:107)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.os.Binder.transact(Binder.java:326)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.internal.bh$4.b(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.internal.bh.a(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.internal.bh.onCreateView(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:285)
09-06 00:15:33.254: E/AndroidRuntime(7812): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
应用程序启动时出现此错误我需要帮助
这是 XML 的结果,但是在其他 xml 中会发生此类错误
<LinearLayout 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:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</LinearLayout>
mi manifestbut i don't found the mistake
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.touchboarder.example.videostream"
android:versionCode="1"
android:versionName="1.0">
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCZG-M6IwXlt46Y37Ip9bp0WdV-shyC39w"/>
<uses-sdk android:minSdkVersion="7" />
<uses-permission
android:name="com.touchboarder.example.videostream.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<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.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
<activity
android:name=".Activity_Home"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity_Reserva" android:label="@string/app_name" android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize">
</activity>
<activity android:name=".Activity_Registro" android:screenOrientation="portrait">
</activity>
<activity android:name=".Activity_Mapa" >
</activity>
</application>
</manifest>