Я получил такую ошибку в консоли 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
Как я понимаю после некоторых исследований, проблема может быть решена на некоторых телефонах под Android 5.0. Я видел этот вопрос и этот , где в последнем ответе на вопрос предлагалось создать новый класс LollipopFixedWebView
. Но я не могу понять, как его использовать. Это означает, что у меня есть такой веб-просмотр:
webView = view.findViewById(R.id.webView)
в моем классе dialogFragment. И где я должен добавить использование новой обертки? Может быть, у кого-то есть решение моей проблемы? И новейший вопрос также был замечен мной:)
ОБНОВЛЕНИЕ
Мой 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>