E/AndroidRuntime: FATAL EXCEPTION: main Process: com.pingtou.loc, PID: 6446 java.lang.RuntimeException: Unable to create application com.pingtou.loc.IMApplication: java.lang.NullPointerException: Attempt to invoke virtual method ‘com.hyphenate.chat.adapter.EMAContactManager com.hyphenate.chat.adapter.EMAChatClient.getContactManager()’ on a null object reference at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6629) at android.app.ActivityThread.access$1400(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:239) at android.app.ActivityThread.main(ActivityThread.java:7604) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:953) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘com.hyphenate.chat.adapter.EMAContactManager com.hyphenate.chat.adapter.EMAChatClient.getContactManager()’ on a null object reference at com.hyphenate.chat.EMClient.contactManager(Unknown Source:8) at com.pingtou.loc.model.EventListener.(EventListener.java:84) at com.pingtou.loc.model.Model.init(Model.java:43) at com.pingtou.loc.IMApplication.onCreate(IMApplication.java:24) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6624) at android.app.ActivityThread.access$1400(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:239) at android.app.ActivityThread.main(ActivityThread.java:7604) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:953)
2 个回复
x2638823
E/AndroidRuntime: FATAL EXCEPTION: main(EventListener.java:84)
Process: com.pingtou.loc, PID: 6446
java.lang.RuntimeException: Unable to create application com.pingtou.loc.IMApplication: java.lang.NullPointerException: Attempt to invoke virtual method ‘com.hyphenate.chat.adapter.EMAContactManager com.hyphenate.chat.adapter.EMAChatClient.getContactManager()’ on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6629)
at android.app.ActivityThread.access$1400(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:239)
at android.app.ActivityThread.main(ActivityThread.java:7604)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:953)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘com.hyphenate.chat.adapter.EMAContactManager com.hyphenate.chat.adapter.EMAChatClient.getContactManager()’ on a null object reference
at com.hyphenate.chat.EMClient.contactManager(Unknown Source:8)
at com.pingtou.loc.model.EventListener.
at com.pingtou.loc.model.Model.init(Model.java:43)
at com.pingtou.loc.IMApplication.onCreate(IMApplication.java:24)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6624)
at android.app.ActivityThread.access$1400(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:239)
at android.app.ActivityThread.main(ActivityThread.java:7604)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:953)
转角45°、嫣然一笑
这个报错是空指针的报错,你可以检查下你的初始化有没有问题,是不是按照文档初始化的