Java android.view.InflateException:二进制XML文件行#7:二进制XML文件行#7:膨胀类片段时出错
i、 我刚刚在我的应用程序中实现了我的第四个标签,它已经实现了谷歌地图。在此实现之前,我的应用程序运行良好,现在当我更改选项卡时,它崩溃。我在这里看到过类似的问题,但没有一个有答案LOL(实际上这个问题有这么多不同的原因和答案) 这是fragmentshouts\u maps课程Java android.view.InflateException:二进制XML文件行#7:二进制XML文件行#7:膨胀类片段时出错,java,android,xml,google-maps,android-fragments,Java,Android,Xml,Google Maps,Android Fragments,i、 我刚刚在我的应用程序中实现了我的第四个标签,它已经实现了谷歌地图。在此实现之前,我的应用程序运行良好,现在当我更改选项卡时,它崩溃。我在这里看到过类似的问题,但没有一个有答案LOL(实际上这个问题有这么多不同的原因和答案) 这是fragmentshouts\u maps课程 package com.example.hp_user.shoutfinal28; import android.os.Bundle; import android.support.v4.app.Fragment
package com.example.hp_user.shoutfinal28;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class FragmentShouts_Maps extends Fragment implements OnMapReadyCallback {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragment shouts.xml
View root_view = inflater.inflate(R.layout.fragmentshouts_maps, container, false);
SupportMapFragment supportMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.Maps1);
if (supportMapFragment!= null) {
supportMapFragment.getMapAsync(this);
}
return root_view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onMapReady (GoogleMap map) {
map.addMarker(new MarkerOptions()
.position(new LatLng(0, 0))
.title("Marker"));
}
}
我的碎片显示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" >
<fragment
android:id="@+id/Maps1"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragmentshouts_maps"
android:layout_alignParentEnd="true">
</fragment>
</RelativeLayout>
这是我的错误日志
_03-24 13:10:44.990 2497-2497/com.example.hp_user.shoutfinal28 I/art:未延迟启用-Xcheck:jni(已启用)
03-24 13:10:45.149 2497-2497/com.example.hp_user.shoutfinal28 W/System:ClassLoader引用的未知路径:/data/app/com.example.hp_user.shoutfinal28-2/lib/x86
03-24 13:10:45.877 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:32.755ms
03-24 13:10:46.344 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:30.264毫秒
03-24 13:10:46.841 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所需时间:18.578ms
03-24 13:10:46.879 2497-2497/com.example.hp_user.shoutfinal28 I/GMPM:App measurement正在启动,版本:8487
03-24 13:10:46.879 2497-2497/com.example.hp_user.shoutfinal28 I/GMPM:启用调试日志运行:adb shell setprop log.tag.GMPM VERBOSE
03-24 13:10:47.126 2497-2497/com.example.hp_user.shoutfinal28 E/GMPM:GoogleService未能初始化,状态:10,缺少用于初始化google服务的预期资源:“R.string.google_app_id”。可能的原因是缺少google-services.json或com.google.gms.google-services gradle插件。
03-24 13:10:47.126 2497-2497/com.example.hp_user.shoutfinal28 E/GMPM:未设置计划程序。未记录错误/警告。
03-24 13:10:47.285 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:10.416ms
03-24 13:10:47.306 2497-2549/com.example.hp_user.shoutfinal28 E/GMPM:无法上载。应用程序测量已禁用
03-24 13:10:48.324 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程需要56.790ms
03-24 13:10:48.692 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所用时间:19.660ms
03-24 13:10:48.735 2497-2571/com.example.hp\u user.shoutfinal28 D/OpenGLRenderer:使用EGL\u交换\u行为\u保留:true
03-24 13:10:49.214 2497-2571/com.example.hp_user.shoutfinal28 I/OpenGLRenderer:初始化EGL,版本1.4
03-24 13:10:49.686 2497-2571/com.example.hp_user.shoutfinal28 W/EGL_仿真:未实现eglSurfaceAttrib
03-24 13:10:49.686 2497-2571/com.example.hp_user.shoutfinal28 W/OpenGLRenderer:未能在表面0xac0bfc40上设置EGL_交换行为,错误=EGL_成功
03-24 13:10:49.713 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:34.869ms
03-24 13:10:50.299 2497-2497/com.example.hp_user.shoutfinal28我/编舞:跳过了88帧!应用程序可能在其主线程上做了太多工作。
03-24 13:10:51.354 2497-2497/com.example.hp_user.shoutfinal28我/编舞:跳过了62帧!应用程序可能在其主线程上做了太多工作。
03-24 13:10:51.698 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所需时间:19.748ms
03-24 13:10:54.816 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程需要68.575ms
03-24 13:10:55.255 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:56.167ms
03-24 13:10:55.684 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所用时间:13.477ms
03-24 13:10:57.162 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所用时间:7.253ms
03-24 13:10:58.712 2497-2549/com.example.hp_user.shoutfinal28 I/GMPM:找不到标记管理器,因此将不会使用
03-24 13:10:59.674 2497-2504/com.example.hp_user.shoutfinal28 W/art:挂起所有线程所需时间:24.761ms
03-24 13:11:00.056 2497-2497/com.example.hp_user.shoutfinal28 I/zzad:动态创建创建者
03-24 13:11:00.148 2497-2497/com.example.hp_user.shoutfinal28 W/System:ClassLoader引用的未知路径:/System/priv-app/PrebuiltGmsCore/lib/x86
03-24 13:11:00.528 2497-2497/com.example.hp_user.shoutfinal28 D/ChimeraCfgMgr:读取存储模块配置
03-24 13:11:00.560 2497-2508/com.example.hp_user.shoutfinal28 I/art:背景粘性并发标记扫描GC释放7893(582KB)AllocSpace对象,5(100KB)LOS对象,13%空闲,3MB/3MB,暂停3.580ms总计263.471ms
03-24 13:11:00.584 2497-2497/com.example.hp_user.shoutfinal28 D/chimeracfgmr:从APK/data/user/0/com.google.android.gms/app_chimera/chimera-module-root/module-a3e4fba11e705727c59ff3116ef21fa4834b9f56/MapsModule.APK加载模块com.google.android.gms.maps
03-24 13:11:00.595 2497-2497/com.example.hp_user.shoutfinal28 D/chimeramoduleld:加载模块APK/data/user/0/com.google.android.gms/app_chimera/chimera-module-root/module-a3e4fba11e705727c59ff3116ef21fa4834b9f56/MapsModule.APK
03-24 13:11:00.781 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所需时间:138.569ms
03-24 13:11:00.781 2497-2497/com.example.hp_user.shoutfinal28 D/ChimeraFileApk:请求进程的主要ABI是x86
03-24 13:11:00.783 2497-2497/com.example.hp_user.shoutfinal28 D/ChimeraFileApk:类加载成功。找到优化的代码。
03-24 13:11:00.825 2497-2497/com.example.hp_user.shoutfinal28 W/System:ClassLoader引用的未知路径:/data/user/0/com.google.android.gms/app_chimera/chimera-module-root/module-a3e4fba11e705727c59ff3116ef21fa4834b9f56/native-libs/x86
03-24 13:11:01.134 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所用时间:22.116ms
03-24 13:11:01.743 2497-2504/com.example.hp_user.shoutfinal28 W/art:暂停所有线程所需时间:81.006ms
03-24 13:11:01.744 2497-2497/com.example.hp_user.shoutfinal28 I/Google地图Android API:Google Play services客户端版本:8487000
03-24 13:11:02.058 2
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="SHOUT"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="SHOUT"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
package com.example.hp_user.shoutfinal28;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
public class ViewPagerAdapter extends FragmentStatePagerAdapter {
final int PAGE_COUNT = 4;
// Tab Titles
private String tabtitles[] = new String[] {"Home","Shouts","Maps","Shouters"};
Context context;
public ViewPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return PAGE_COUNT;
}
public Fragment getItem(int position) {
switch (position) {
// Open Fragment home.java
case 0:
FragmentHome fragmenthome = new FragmentHome();
return fragmenthome;
// Open Fragment shouters.java
case 1:
FragmentShouts fragmentshouts = new FragmentShouts();
return fragmentshouts;
case 2:
FragmentShouts_Maps fragmentshouts_maps = new FragmentShouts_Maps();
return fragmentshouts_maps;
case 3:
FragmentShouters fragmentshouters = new FragmentShouters();
return fragmentshouters;
}
return null;
}
@Override
public CharSequence getPageTitle(int position) {
return tabtitles[position];
}
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SupportMapFragment supportMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.Maps1);
if (supportMapFragment!= null) {
supportMapFragment.getMapAsync(this);
}
}