I'm using OneSignal to send push notifications to my Android app. I have added nothing special to the code of the app, just completed their basic setup, ie - addied their implementaion in build.gradle and created an ApplicationClass. It's all done exactly as their docs.
This is my ApplicationClass.java:
package com.ananya.brokenhearts;
import android.app.Application;
import com.onesignal.OSNotification;
import com.onesignal.OneSignal;
@SuppressWarnings("unused")
public class ApplicationClass extends Application
{
@Override
public void onCreate()
{
super.onCreate();
OneSignal.startInit(this)
.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.unsubscribeWhenNotificationsAreDisabled(true)
.init();
}
}
Now, whenever I'm sending a notification through my dashboard and my app's in the foreground, it crashes. I have implemented Google Firebase Crashlytics which show the error to me as:
Fatal Exception: java.lang.NoSuchMethodError
No static method zzc(Landroid/content/Context;)Lcom/google/firebase/iid/zzs; in class Lcom/google/firebase/iid/zzs; or its super classes (declaration of 'com.google.firebase.iid.zzs' appears in /data/app/com.ananya.brokenhearts-VRiRdquDLM8iTGbzmELvkg==/base.apk)
What does the error mean and how can I stop this crash?
I updated OneSignal plugin to version 0.11.2 in app/build.gradle
and my application stopped crashing:
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.11.2'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.