如何解决Webview android 5.0的问题?

如何解决Webview android 5.0的问题?,android,webview,Android,Webview,我在Google Play控制台收到这样的错误: FATAL EXCEPTION: ControllerMessenger Process: de.jobnetzwerk.jobnet, PID: 21170 android.view.InflateException: Binary XML file line #216: Error inflating class android.webkit.WebView at android.view.LayoutInflater.cre

我在Google Play控制台收到这样的错误:

    FATAL EXCEPTION: ControllerMessenger
Process: de.jobnetzwerk.jobnet, PID: 21170
android.view.InflateException: Binary XML file line #216: Error inflating class android.webkit.WebView
    at android.view.LayoutInflater.createView(LayoutInflater.java:652)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at com.android.internal.policy.impl.HwPhoneLayoutInflater.onCreateView(HwPhoneLayoutInflater.java:75)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:701)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:760)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:825)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:523)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
    at de.jobnetzwerk.jobnet.jobAGENT.JobView.onCreateView(JobView.kt:82)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
    at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
    at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
    at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
    at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
    at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
    at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
    at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at androidx.test.espresso.base.Interrogator.a(Interrogator.java:19)
    at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:169)
    at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:161)
    at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:34)
    at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:77)
    at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:52)
    at androidx.test.espresso.action.Tap.c(Tap.java:8)
    at androidx.test.espresso.action.Tap.b(Tap.java:19)
    at androidx.test.espresso.action.Tap$1.a(Tap.java:3)
    at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:20)
    at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:9)
    at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:79)
    at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:97)
    at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:3)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5538)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:626)
    ... 44 more
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x3040002
    at android.content.res.HwResources.getText(HwResources.java:1252)
    at android.content.res.Resources.getString(Resources.java:374)
at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(Cont

据我了解,经过一些研究,在安卓5.0下的一些手机上可以解决这个问题。我看到了问题和,在最后一个问题中,答案建议创建一个新类
棒棒糖FixedWebView
。但是我不知道怎么用它。这意味着,我有这样的网络视图:

webView = view.findViewById(R.id.webView)
在我的课堂上。我必须在哪里添加新包装的用法?也许有人能解决我的问题?我也看到了这个问题:)

更新 我的xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="vertical">


    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:subtitleTextAppearance="@style/Toolbar.SubtitleText"
            app:titleTextAppearance="@style/Toolbar.TitleText" />

    </com.google.android.material.appbar.AppBarLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="7dp"
        android:layout_marginTop="7dp"
        android:layout_marginEnd="7dp"
        android:layout_marginBottom="3.5dp"
        android:background="@drawable/old_item">

        <RelativeLayout
            android:id="@+id/content_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/status_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="10dp"
                android:orientation="horizontal"
                android:weightSum="10">

                <TextView
                    android:id="@+id/job_type"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="5"
                    android:textColor="@color/gray" />

                <TextView
                    android:id="@+id/date_of_item"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="10dp"
                    android:layout_weight="5"
                    android:gravity="end"
                    android:textAlignment="viewEnd"
                    android:textColor="@color/gray" />
            </LinearLayout>


            <TextView
                android:id="@+id/title_of_item"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/status_layout"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginEnd="48dp"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/black"
                android:textStyle="bold" />

            <ImageView
                android:id="@+id/printer_btn"
                android:layout_width="28dp"
                android:layout_height="24dp"
                android:layout_below="@id/status_layout"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="10dp"
                android:visibility="invisible"
                android:labelFor="@id/printer_btn"
                android:layout_marginEnd="10dp"
                android:background="@drawable/ic_printer_icon" />


            <TextView
                android:id="@+id/company_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/title_of_item"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="48dp"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/gray" />

            <TextView
                android:id="@+id/job_location"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/company_name"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="48dp"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/gray_light" />


            <ImageView
                android:id="@+id/add_to_notepad"
                android:layout_width="28dp"
                android:layout_height="24dp"
                android:labelFor="@id/add_to_notepad"
                android:layout_alignBottom="@id/job_location"
                android:layout_alignParentEnd="true"
                android:layout_marginEnd="10dp" />

            <ProgressBar
                android:id="@+id/progressBar"
                android:layout_width="28dp"
                android:layout_height="24dp"
                android:layout_below="@id/printer_btn"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:labelFor="@id/progressBar"
                android:scaleType="fitCenter"
                android:visibility="invisible" />

            <LinearLayout
                android:id="@+id/job_status"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/add_to_notepad"
                android:layout_marginStart="10dp"
                android:layout_marginTop="20dp"
                android:orientation="horizontal"
                android:weightSum="10">

                <TextView
                    android:id="@+id/job_id"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="6"
                    android:text="@string/job_id"
                    android:textColor="@color/gray" />


                <TextView
                    android:id="@+id/write_to_company"
                    android:layout_width="0dp"
                    android:minHeight="48dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="10dp"
                    android:layout_weight="4"
                    android:text="@string/write_to_company_job_view"
                    android:textAlignment="center"
                    android:gravity="center|end"
                    android:textColor="@color/colorAccent" />
            </LinearLayout>

            <View
                android:id="@+id/view2"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:layout_below="@id/job_status"
                android:layout_marginStart="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:background="@color/gray_light" />
        </RelativeLayout>


        <TextView
            android:id="@+id/job_link"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/content_layout"
            android:layout_marginStart="10dp"
            android:layout_marginTop="5dp"
            android:layout_marginEnd="54dp"
            android:ellipsize="end"
            android:singleLine="true"
            android:textColor="@color/gray" />

        <ImageView
            android:id="@+id/hide_content"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_below="@id/content_layout"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="5dp"
            android:labelFor="@id/hide_content"
            android:layout_marginEnd="10dp"
            android:src="@drawable/ic_up_arrow" />

    </RelativeLayout>


    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="7dp"
        android:layout_marginTop="3.5dp"
        android:layout_marginEnd="7dp"
        android:layout_marginBottom="7dp"
        android:labelFor="@id/swipeContainer"
        android:background="@color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <WebView
            android:id="@+id/webView"
            android:labelFor="@id/webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>


</LinearLayout>


发布您的XMLfile@mohammadRezaAbiri,我已经更新了我的问题,请检查:)那是完整的stacktrace吗?还有什么吗?@VladyslavMatviienko,请检查更新的答案:)
棒棒糖FixedWebView
-创建这些问题中显示的Cals,并在XML中使用它,而不是像任何自定义视图一样在WebVIew中使用它