解决system_server crash,java.lang.IllegalStateException: has already been added to the window manager.

Android APP&Framework 专栏收录该内容
60 篇文章 0 订阅

日志描述:

Process: system_server
Build: Android/aosp_coral_car/coral:10/QQ3A.200705.002/eng.bill.20210413.091937:userdebug/test-keys

java.lang.IllegalStateException: View android.widget.LinearLayout{72fec73 VFE...C.. ......I. 0,0-0,0 #1020353 android:id/ndmode_ll} has already been added to the window manager.
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:359)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
    at com.android.internal.widget.NDModeView.addView(NDModeView.java:109)
    at com.android.server.wm.DisplayPolicy.enableNDMode(DisplayPolicy.java:3760)
    at com.android.server.wm.DisplayPolicy.access$800(DisplayPolicy.java:187)
    at com.android.server.wm.DisplayPolicy$PolicyHandler.handleMessage(DisplayPolicy.java:436)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.os.HandlerThread.run(HandlerThread.java:67)
    at com.android.server.ServiceThread.run(ServiceThread.java:44)
    at com.android.server.UiThread.run(UiThread.java:43)

 

解决方案:

    public void addView() {
        debug(DEBUG, "Function, addView(), has been executed.1");
        if(mXXXView.getParent() != null){
            mWindowManager.removeViewImmediate(mXXXView);
        }
        mWindowManager.addView(mXXXView, mLayoutParams);
    }

  • 1
    点赞
  • 3
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值