【问题标题】:java.lang.StackOverflowError: stack size 8MB at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7531)java.lang.StackOverflowError:堆栈大小 8MB 在 android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7531)
【发布时间】:2018-08-22 11:40:29
【问题描述】:

我已将 Android SDK 23 升级到 26 Api 库, 应用程序正在使用 Listview、Fragment、FrameLayout、Relative 和 Linear 布局。

升级的主屏幕
-> 协调器布局
-> AppBarLayout
-> 折叠工具栏布局
-> 工具栏
-> 滑动标签布局

内屏的其余部分都是一样的。

问题是:应用程序启动并打开主屏幕,一段时间后/一段时间后应用程序出现以下(以下)错误并崩溃。无法找到根本原因。搜索了很多,发现可能是 ListView Adapters 有问题。请给我一个想法。

08-22 16:46:19.057 5234-6825/? E/Watchdog: !@Sync 12989 [2018-08-22 16:46:19.057]
08-22 16:46:19.324 3237-3237/? E/Sensors: inject_scontext_data: New ssp_data_injection_fd(32)

08-22 16:46:20.987 6696-6696/? E/SignalClusterView: setSlotFocusVisible : subId 2
setSlotFocusVisible : subId 2
08-22 16:46:23.282 21569-21569/com.XXXX E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.XXXX, PID: 21569
java.lang.StackOverflowError: stack size 8MB
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7531)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
  08-22 16:46:23.285 21569-21569/com.nimbuzz E/AndroidRuntime:     at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)
    at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:7533)

【问题讨论】:

  • 看来您在递归中调用了相同的方法。
  • 嗨,Keyur Thumar,你能举个例子,这样我就能找到正确的答案。
  • 你能在这里分享代码吗?,会看看它。

标签: android android-layout listview


【解决方案1】:

inflate(R.layout.layout2,container) 更改为inflate(R.layout.layout2,null)inflate(R.layout.layout2,container,false)。希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-04
    • 2016-09-01
    相关资源
    最近更新 更多