try*_*ryp 4 android android-notifications google-cloud-messaging
我尝试在Gradle项目中更新GCM服务(Google云消息)库(从7.5到8.3.0).但是现在,有了这个新版本,我无法启动之前完美运行的先前活动.
处理以下错误的代码是:
Intent in = new Intent(this, MyGcmListenerService.class);
startService(in);
MyGcmListenerService.java:
public class MyGcmListenerService extends GcmListenerService
{
    private static final String TAG = "MyGcmListenerService";
    @Override
    public void onMessageReceived(String from, Bundle data)
    {
        Log.w(TAG, "onMessageReceived");
    }
返回的错误:
FATAL EXCEPTION: AsyncTask #1
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:818)
Gradle文件:
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
}
如果我回滚到之前的GCM版本(7.5),它会按预期工作.你知道改变了什么吗?我检查了更改日志,但我无法找到有关它的任何信息. https://developers.google.com/android/guides/releases
谢谢您的帮助
| 归档时间: | 
 | 
| 查看次数: | 1189 次 | 
| 最近记录: |