GCM unregister causing the application to crash

前端 未结 4 1564
别跟我提以往
别跟我提以往 2020-12-15 04:38

I\'ve implemented GCM notifications on my app. I am now trying to un-register the app when the user logs out. I am using the following code. When this code executes, it caus

相关标签:
4条回答
  • 2020-12-15 04:58

    Update the google play services to the latest version (9.8.0) after updating the android support library to 25.0.0 I had the same problem this morning and this worked for me :)

    0 讨论(0)
  • 2020-12-15 04:59

    I was with same problem after update the support library to 25.0.0 . For me after update the below libs,in the app gradle file, the problem gone.

    compile("com.google.android.gms:play-services-location:9.6.1")
    compile("com.google.android.gms:play-services-maps:9.6.1")
    compile("com.google.android.gms:play-services-gcm:9.6.1")
    
    0 讨论(0)
  • 2020-12-15 05:11

    use dependencies in the given way

    compile ("com.google.android.gms:play-services-base:10.0.1") {
            force = true;
        }
        compile ("com.google.android.gms:play-services-maps:10.0.1") {
            force = true;
        }
        compile ("com.google.android.gms:play-services-gcm:10.0.1") {
            force = true;
        }
        compile ('com.google.firebase:firebase-core:10.0.1') {
            force = true;
        }
        compile ('com.google.firebase:firebase-messaging:10.0.1') {
            force = true;
        }
    
    0 讨论(0)
  • 2020-12-15 05:15

    Not sure this will solve your problem, but it's always a good idea to pass the application Context to third party frameworks, rather than Activity instances, as the latter can lead to memory leaks. Try this instead:

    InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
    
    0 讨论(0)
提交回复
热议问题