跟着视频敲的,为什么会报这个错误?

来源:5-6 Loading框架集成与完善(AVLoadingIndicatorView)-2

慕丝7386281

2019-11-14

Process: com.zxl.test, PID: 23951
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zxl.test/com.zxl.test.ExampleActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.wang.avi.Indicator.setColor(int)’ on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThreadH.handleMessage(ActivityThread.java:1688)atandroid.os.Handler.dispatchMessage(Handler.java:105)atandroid.os.Looper.loop(Looper.java:164)atandroid.app.ActivityThread.main(ActivityThread.java:6798)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.ZygoteH.handleMessage(ActivityThread.java:1688) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6798) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteH.handleMessage(ActivityThread.java:1688)atandroid.os.Handler.dispatchMessage(Handler.java:105)atandroid.os.Looper.loop(Looper.java:164)atandroid.app.ActivityThread.main(ActivityThread.java:6798)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.ZygoteMethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.wang.avi.Indicator.setColor(int)’ on a null object reference
at com.wang.avi.AVLoadingIndicatorView.setIndicatorColor(AVLoadingIndicatorView.java:148)
at com.wang.avi.AVLoadingIndicatorView.setIndicator(AVLoadingIndicatorView.java:125)
at com.zxl.latte_core.ui.LoaderCreator.create(LoaderCreator.java:18)
at com.zxl.latte_core.ui.LatteLoader.showLoading(LatteLoader.java:28)
at com.zxl.latte_core.ui.LatteLoader.showLoading(LatteLoader.java:24)
at com.zxl.latte_core.net.RestClient.request(RestClient.java:78)
at com.zxl.latte_core.net.RestClient.get(RestClient.java:127)
at com.zxl.test.ExampleDelegate.testClient(ExampleDelegate.java:46)
at com.zxl.test.ExampleDelegate.onBindView(ExampleDelegate.java:23)
at com.zxl.latte_core.delegate.BaseDelegate.onCreateView(BaseDelegate.java:45)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3273)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:620)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1412)
at android.app.Activity.performStart(Activity.java:7020)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2909)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThreadH.handleMessage(ActivityThread.java:1688)atandroid.os.Handler.dispatchMessage(Handler.java:105)atandroid.os.Looper.loop(Looper.java:164)atandroid.app.ActivityThread.main(ActivityThread.java:6798)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.ZygoteH.handleMessage(ActivityThread.java:1688) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6798) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteH.handleMessage(ActivityThread.java:1688)atandroid.os.Handler.dispatchMessage(Handler.java:105)atandroid.os.Looper.loop(Looper.java:164)atandroid.app.ActivityThread.main(ActivityThread.java:6798)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.ZygoteMethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

写回答

2回答

慕丝7386281

提问者

2019-11-15

已解决

0
0

慕丝7386281

提问者

2019-11-14

//img.mukewang.com/szimg/5dcd71ca0946ed3111250436.jpg这行报错,能麻烦老师帮忙看看这是为什么吗?我debuger了 我传进来的值不是空的

0
0

Android通用框架设计与完整电商App开发

从第一行代码开始教你,通用且一键式配置的框架设计并轻松实现完整电商App

2028 学习 · 1182 问题

查看课程