程序运行一会就崩溃(代码和老师的一样)

程序运行一会就崩溃(代码和老师的一样)

2020-07-13 16:23:39.915 7111-7111/com.tom.mall E/AndroidRuntime:     at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

2020-07-13 16:23:39.916 7111-7111/com.tom.mall E/AndroidRuntime:     at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.ItemBuilder$Companion.builder$mall_library_debug(ItemBuilder.kt:15)

        at com.tom.mallLibrary.fragments.bottom.BaseBottomFragment.onCreate(BaseBottomFragment.kt:55)

        at androidx.fragment.app.Fragment.performCreate(Fragment.java:2586)

        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:838)

        at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1197)

        at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1080)

        at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:119)

2020-07-13 16:23:39.916 7111-7111/com.tom.mall E/AndroidRuntime:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1866)

        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)

        at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)

        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)

        at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)

        at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)

        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)

        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)

        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1335)

        at android.app.Activity.performStart(Activity.java:7043)

        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2744)

        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)

        at android.app.ActivityThread.-wrap11(Unknown Source:0)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592)

        at android.os.Handler.dispatchMessage(Handler.java:106)

        at android.os.Looper.loop(Looper.java:164)

        at android.app.ActivityThread.main(ActivityThread.java:6518)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

2020-07-13 16:23:42.565 1485-1527/system_process E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.hytera.launcher/com.hytera.main.LauncherActivity/1


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕雪 2020-07-13 16:48:38

1)ItemBuilder.kt第15行是什么代码,应该是这块导致的问题。 2)具体什么原因没有描述清楚,你看一下,是不是信息没有贴全呢。 3)是你做什么操作了导致的崩溃还是打开应用什么都不做,过一会儿就会崩溃呢?再详细的描述一下。祝:学习愉快

  • 提问者 Tom_J #1
    class ItemBuilder { //不能使用hashMap,因为hashMap是无序的 private val mItems = LinkedHashMap<BottomTabBean, BottomItemFragment>() companion object{ internal fun builder():ItemBuilder{ return builder() } } 有问题的代码就是这个builder,程序只运行了,什么操作都没有,看日志有个java.lang.StackOverflowError: stack size 8MB,感觉返回值应该写成this,我试一下,这块循环调用了,导致了这个error
    2020-07-13 16:55:53
  • 提问者 Tom_J #2
    问题解决了,应该返回ItemBuilder()
    2020-07-13 17:20:58
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师