Android.view.InflateException: двоичная строка XML-файла # 6: ошибка раздувания класса fragemnt

Эта ошибка возникает, когда приложение запускается

Я получаю много ошибок вида, отображаемых в subj. Эти ошибки кажутся случайными, и я не могу их воспроизвести. Из стека я могу узнать, что такая ошибка может возникнуть для моих разных ресурсов макета. Линия 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, однако такая ошибка возникает в других xmls

 <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> ? 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> Размер 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> 

 <application> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="youApiKey" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> 

Находится в элементе AndroidManifest.xml

использование

 import android.support.v4.app.Fragment; YourActivity extends FragmentActivity 

вместо

 import android.app.Fragment; YourActivity extends Activity 

И добавьте API-ключ в файл манифеста

Вы должны добавить этот тег в свой файл AndroidManifest:

 <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your APi key here" /> 

Ваш logcat показывает, что вы не добавили API KEY в свой файл AndroidManifest .

Добавьте API-ключ в файл манифеста, как показано ниже:

 <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your APi key here" /> 

Если вы пытаетесь показать карту в Fragment, тогда в вашем файле макета вам нужно написать имя класса, как показано ниже:

  <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.SupportMapFragment"/>