E/AndroidRuntime: FATAL EXCEPTION: main\n Process: com.example.zhcs6, PID: 19682\n java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference\n at com.example.zhcs6.ZhbsActivity.ZhbsActivity$getList$1$1$1$1.invoke(ZhbsActivity.kt:52)\n at com.example.zhcs6.ZhbsActivity.ZhbsActivity$getList$1$1$1$1.invoke(ZhbsActivity.kt:44)\n at com.example.zhcs6.Logic.HttpUnit$get$2.onResponse$lambda-0(Http.kt:90)\n at com.example.zhcs6.Logic.HttpUnit$get$2.$r8$lambda$7fDl4E8OtSZV7EVDGHAo7f3fxw4(Unknown Source:0)\n at com.example.zhcs6.Logic.HttpUnit$get$2$ExternalSyntheticLambda0.run(Unknown Source:4)\n at android.os.Handler.handleCallback(Handler.java:789)\n at android.os.Handler.dispatchMessage(Handler.java:98)\n at android.os.Looper.loop(Looper.java:164)\n at android.app.ActivityThread.main(ActivityThread.java:6541)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)\nThis is a Java NullPointerException. In your code, you are attempting to call a method on a null object, which is not allowed. Specifically, on line 52 of your code, you are trying to call the 'add' method on a null List object. You need to ensure that the List object is properly initialized before calling the 'add' method. Check the part of your code that deals with this List object to find where it's not being initialized correctly and fix it.


原文地址: https://www.cveoy.top/t/topic/p5m7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录