android - 安卓AVOS-cloud 消息推送报错
PHPz
PHPz 2017-04-17 11:33:23
0
1
579

试用了AVOS-cloud 的安卓推送。
跟着 Android 消息推送的文档,可是一直报错。

03-14 14:31:31.304: E/AndroidRuntime(13791): FATAL EXCEPTION: main
03-14 14:31:31.304: E/AndroidRuntime(13791): java.lang.RuntimeException: Unable to create service com.avos.avoscloud.PushService: java.lang.NullPointerException
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2651)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.app.ActivityThread.access$1600(ActivityThread.java:150)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.os.Looper.loop(Looper.java:213)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.app.ActivityThread.main(ActivityThread.java:5225)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at java.lang.reflect.Method.invokeNative(Native Method)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at java.lang.reflect.Method.invoke(Method.java:525)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at dalvik.system.NativeStart.main(Native Method)
03-14 14:31:31.304: E/AndroidRuntime(13791): Caused by: java.lang.NullPointerException
03-14 14:31:31.304: E/AndroidRuntime(13791):    at com.avos.avoscloud.AVInstallation.getCurrentInstallation(AVInstallation.java:38)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at com.avos.avoscloud.PushService.onCreate(PushService.java:59)
03-14 14:31:31.304: E/AndroidRuntime(13791):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2641)
03-14 14:31:31.304: E/AndroidRuntime(13791):    ... 10 more

有人遇到同样的问题吗?

PHPz
PHPz

学习是最好的投资!

reply all(1)
迷茫

Please make sure to initialize AVOSCloud in Application.

public class MyApplication extends Application 
{ 
   public void onCreate() { 
     AVOSCloud.useAVCloudCN();
     AVOSCloud.initialize(this, "yourAppId", "yourAppKey"); 
   }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template