当前位置: 代码迷 >> java >> 关于Android Frameworks基础:android.view.InflateException二进制XML#18错误夸大类
  详细解决方案

关于Android Frameworks基础:android.view.InflateException二进制XML#18错误夸大类

热度:28   发布时间:2023-07-17 21:05:14.0

当我点击导航栏上的方形按钮(recents应用程序)时,我得到了systemUI fc。我已获取有关该详细日志的日志。

E/AndroidRuntime( 2748): FATAL EXCEPTION: main
E/AndroidRuntime( 2748): Process: com.android.systemui, PID: 2748
E/AndroidRuntime( 2748): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.systemui/com.android.systemui.recents.RecentsActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
E/AndroidRuntime( 2748):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2340)
E/AndroidRuntime( 2748):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2402)
E/AndroidRuntime( 2748):    at android.app.ActivityThread.access$900(ActivityThread.java:151)
E/AndroidRuntime( 2748):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1318)
E/AndroidRuntime( 2748):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2748):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2748):    at android.app.ActivityThread.main(ActivityThread.java:5269)
E/AndroidRuntime( 2748):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2748):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2748):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime( 2748):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
E/AndroidRuntime( 2748): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.createView(LayoutInflater.java:633)
E/AndroidRuntime( 2748):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:892)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
E/AndroidRuntime( 2748):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
E/AndroidRuntime( 2748):    at android.app.Activity.setContentView(Activity.java:2145)
E/AndroidRuntime( 2748):    at com.android.systemui.recents.RecentsActivity.onCreate(RecentsActivity.java:384)
E/AndroidRuntime( 2748):    at android.app.Activity.performCreate(Activity.java:5990)
E/AndroidRuntime( 2748):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
E/AndroidRuntime( 2748):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2293)
E/AndroidRuntime( 2748):    ... 10 more
E/AndroidRuntime( 2748): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2748):    at java.lang.reflect.Constructor.newInstance(Native Method)
E/AndroidRuntime( 2748):    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
E/AndroidRuntime( 2748):    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
E/AndroidRuntime( 2748):    ... 24 more
E/AndroidRuntime( 2748): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
E/AndroidRuntime( 2748):    at android.content.res.TypedArray.getDimensionPixelOffset(TypedArray.java:533)
E/AndroidRuntime( 2748):    at android.view.View.<init>(View.java:3798)
E/AndroidRuntime( 2748):    at android.view.ViewGroup.<init>(ViewGroup.java:497)
E/AndroidRuntime( 2748):    at android.widget.FrameLayout.<init>(FrameLayout.java:115)
E/AndroidRuntime( 2748):    at android.widget.FrameLayout.<init>(FrameLayout.java:111)
E/AndroidRuntime( 2748):    at android.widget.FrameLayout.<init>(FrameLayout.java:107)
E/AndroidRuntime( 2748):    ... 27 more

这是日志

这是RecentsActivity.java,其中错误在第384行

第384行:-`//设置“最近”布局setContentView(R.layout.recents);

以及最近的Activitys.java的一部分

/** Called with the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // For the non-primary user, ensure that the SystemServicesProxy and configuration is
    // initialized
    RecentsTaskLoader.initialize(this);
    SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();
    mConfig = RecentsConfiguration.reinitialize(this, ssp);

    // Initialize the widget host (the host id is static and does not change)
    mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId);

    // Set the Recents layout
    setContentView(R.layout.recents);
    mRecentsView = (RecentsView) findViewById(R.id.recents_view);
    mRecentsView.setCallbacks(this);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
            View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
    mDebugOverlayStub = (ViewStub) findViewById(R.id.debug_overlay_stub);
    mScrimViews = new SystemBarScrimViews(this, mConfig);
    mStatusBar = ((SystemUIApplication) getApplication())
            .getComponent(PhoneStatusBar.class);
    inflateDebugOverlay();

这是包/systemui/res/layout/recents.xml中的recents.xml

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" 
android:layout_height="match_parent">
<!-- Status Bar Scrim View -->
<ImageView
    android:id="@+id/status_bar_scrim"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|top"
    android:scaleType="fitXY"
    android:src="@drawable/recents_status_gradient" />

<!-- Recents View -->
<com.android.systemui.recents.views.RecentsView
    android:id="@+id/recents_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true" />

<!-- Empty View -->
<ViewStub android:id="@+id/empty_view_stub"
       android:layout="@layout/recents_empty"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />

<!-- Debug Overlay View -->
<ViewStub android:id="@+id/debug_overlay_stub"
       android:layout="@layout/recents_debug_overlay"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />

<!-- Nav Bar Scrim View -->
<ImageView
    android:id="@+id/nav_bar_scrim"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:scaleType="fitXY"
    android:src="@drawable/recents_lower_gradient" />

<include layout="@layout/floating_action_button" />

请帮我该怎么办...

希望有一个解决办法

谢谢

我认为是针对系统应用程序层使用“ com.android.systemui.recents.views.RecentsView”的问题。

请检查您编译的SDK和目标SDK版本。

  相关解决方案