Я получаю сообщение об ошибке InflateExcepetion в моем коде, за исключением Resource not found. Я следил за множеством потоков для подобного рода исключений, но, похоже, все решение предоставляет информацию о раздувании макета, размер изображения слишком велик или иногда возникает из-за исключения OOM.
Мои журналы ошибок переносят меня в строку кода, где я создаю объект DialogBox.
ниже строка кода, где я получаю этот класс исключений: MySettingsDialog .
dialog = new DialogView(context)
dialog.setContentPaddings(10, 10, 10, 10);
dialog.setDialogWidth(450);
dialog.setFirstButtonText(context.getString(R.string.button_apply));
dialog.setSecondButtonText(context.getString(R.string.button_cancel));
dialog.setThirdButtonText(null);
dialog.showThirdButton(false);
dialog.setTitle(context.getString(R.string.bo_settings_title));
P.S> Это исключение случается не часто, так как мне нужно запустить скрипт автоматизации, чтобы получить это исключение и вылет.
Ниже находятся журналы, которые я прилагаю
android.view.InflateException: Binary XML file line #65: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.dialog.DialogView.init(DialogView.java:165)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:81)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:71)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:63)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.pqr.def.qqq.SettingsDialog.<init>(SettingsDialog.java:100)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.pqr.def.qqq.MapViewData.BoSettings(MapViewData.java:8137)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.pqr.def.qqq.MapViewData.access$41700(MapViewData.java:163)
03-13 16:37:38.742 W/LoggingEvent( 1798): Caused by: java.lang.reflect.InvocationTargetException
03-13 16:37:38.742 W/LoggingEvent( 1798): at java.lang.reflect.Constructor.constructNative(Native Method)
03-13 16:37:38.742 W/LoggingEvent( 1798): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
03-13 16:37:38.742 W/LoggingEvent( 1798): ... 23 more
03-13 16:37:38.742 W/LoggingEvent( 1798): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020145
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.content.res.Resources.getValue(Resources.java:1118)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.content.res.Resources.getDrawable(Resources.java:693)
03-13 16:37:38.742 W/LoggingEvent( 1798): at android.widget.CompoundButton.setButtonDrawable(CompoundButton.java:185)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.widget.control.CheckBox.init(CheckBox.java:39)
03-13 16:37:38.742 W/LoggingEvent( 1798): at com.abc.android.widget.control.CheckBox.<init>(CheckBox.java:28)
03-13 16:37:38.742 W/LoggingEvent( 1798): ... 26 more
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): *** UNCAUGHT EXCEPTION IN THREAD Thread[main,5,main] ***
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): android.view.InflateException: Binary XML file line #65: Error inflating class <unknown>
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.android.dialog.DialogView.init(DialogView.java:165)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:81)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:71)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.android.dialog.DialogView.<init>(DialogView.java:63)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.pqr.def.qqq.SettingsDialog.<init>(MySettingsDialog.java:100)
03-13 16:37:38.744 E/WindowsManagerApplication( 1798): at com.abc.pf.map.data.MyMap.checkUIForBoSettings(MyMap.java:8137)
DialogView.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialogRoot"
android:layout_width="336dp"
android:layout_height="wrap_content"
android:background="@drawable/dialog_window_expand_bkg"
android:minHeight="233dp"
android:minWidth="336dp"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/llTopBar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/header_dialog" >
<ImageView
android:id="@+id/titleIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:visibility="gone" />
<TextView
android:id="@+id/tvTitle"
style="@style/TextAppearance.abcDialog.Small.Title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/titleIcon"
android:gravity="center"
android:text="Title" />
<ImageButton
android:id="@+id/close"
style="@style/CloseStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:visibility="gone" />
</RelativeLayout>
<FrameLayout
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="162dp"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp" >
</FrameLayout>
<LinearLayout
android:id="@+id/rlBottomBar"
android:layout_width="match_parent"
android:layout_height="54dp"
android:background="@drawable/button_area_dialog"
android:gravity="right|center_vertical"
android:paddingRight="12dp" >
<com.abc.android.widget.control.CheckBox
android:id="@+id/bottom_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:scaleX="0.8"
android:scaleY="0.8"
/>
<TextView
android:id="@+id/bottom_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#333333"
android:textSize="18sp"
android:layout_weight="1"/>
<Button
android:id="@+id/btFifth"
style="@style/ButtonSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:minWidth="78dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:text="Fifth"
android:visibility="gone"/>
<Button
android:id="@+id/btFourth"
style="@style/ButtonSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:minWidth="78dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:text="Fourth"
android:visibility="gone"/>
<Button
android:id="@+id/btThird"
style="@style/ButtonSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:minWidth="78dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:text="Third" />
<Button
android:id="@+id/btSecond"
style="@style/ButtonSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:minWidth="78dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:text="Second" />
<Button
android:id="@+id/btFirst"
style="@style/ButtonSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:minWidth="78dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:text="First" />
</LinearLayout>
</LinearLayout>