Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AbstractMethodError with Firebase Cloud Messaging

I've just changed our app's GCM out to FCM, and also added OneSignal to it. Followed the guides to the letter, even created a new listener service for processing push notifications.

However even without the listener, whenever I receive a push, the app crashes with the following message:

09-27 14:11:21.483 25361-25361/com.appname.here E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appname.here, PID: 25361
java.lang.AbstractMethodError: abstract method "android.content.Intent com.google.firebase.iid.zzb.zzae(android.content.Intent)"
    at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3028)
    at android.app.ActivityThread.access$2200(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1454)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5551)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

I've removed every code from the listener, and even then, this happens.

Did I implement something the wrong way, or am I missing something?

Build.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.22.0'
    }
}
apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
    lintOptions {
        checkReleaseBuilds false
    }
    dexOptions {
        javaMaxHeapSize "2g"
    }
    signingConfigs {
        release {

        }
        debug {

        }
    }
    compileSdkVersion 24
    buildToolsVersion '24.0.1'

    defaultConfig {
        applicationId "com.appname.here"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode getDate()
        versionName '2.1.0'
        multiDexEnabled true

        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "*******",
                                onesignal_google_project_number: "********"]
    }

    applicationVariants.all { variant ->
        def apkName = "appnamehere";
        apkName += "_" + variant.buildType.name + "_" + android.defaultConfig.versionName + "_" + android.defaultConfig.versionCode;
        variant.outputs.each { output ->
            output.outputFile = new File(output.outputFile.parent, apkName + ".apk");
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            debuggable true
            jniDebuggable true
            signingConfig signingConfigs.release
            renderscriptDebuggable true

        }
    }
    productFlavors {
        Live {
            signingConfig signingConfigs.release
        }
        Develop {
            signingConfig signingConfigs.release
            applicationIdSuffix ".develop"
        }
    }
}

def getDate() {
    def date = new Date()
    def formattedDate = date.format('yyMMddHHmm')
    return formattedDate.toInteger()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //compile project(':libphonenumber-5.9')
    compile project(':jaalee-sdk')
    compile project(':socialauth-android-3.2')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.4@aar') {
        transitive = true;
    }

    compile 'com.google.android.gms:play-services-gcm:9.6.1'
    compile 'com.onesignal:OneSignal:3.3.0@aar'

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.android.support:customtabs:24.2.1'
//    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'
    compile 'com.google.android.gms:play-services-ads:9.6.1'
    compile 'com.google.android.gms:play-services-analytics:9.6.1'
    compile 'com.google.android.gms:play-services-auth:9.6.1'
    compile 'com.google.android.gms:play-services-identity:9.6.1'
    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.maps.android:android-maps-utils:0.4'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.5.2'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.jakewharton:butterknife:8.2.1'
    compile 'com.thebluealliance:spectrum:0.5.0'
    compile 'com.joanzapata.iconify:android-iconify-entypo:2.2.2'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    compile 'com.joanzapata.iconify:android-iconify-material:2.2.2'
    compile 'com.joanzapata.iconify:android-iconify-material-community:2.2.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jonathanfinerty.once:once:1.2.1'
    apt 'com.jakewharton:butterknife-compiler:8.2.1'

    compile 'com.google.firebase:firebase-core:9.2.0'
    compile "com.google.firebase:firebase-messaging:9.0.2"

    compile 'com.github.clans:fab:1.6.4'                // Expandable floating button.
    compile 'com.androidadvance:topsnackbar:1.1.1'      // Top snackbar.
    compile 'com.baoyz.swipemenulistview:library:1.3.0' // Swipeable listview.
    compile 'me.relex:circleindicator:1.2.1@aar'        // Pager indicator.
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
}

apply plugin: 'com.google.gms.google-services'

crashlytics {
    enableNdk true
    androidNdkOut 'src/main/obj'
    androidNdkLibsOut 'src/main/libs'
}
like image 655
fonix232 Avatar asked Sep 27 '16 12:09

fonix232


People also ask

Is there any limit for Firebase Cloud Messaging?

Maximum message rate to a single device For Android, you can send up to 240 messages/minute and 5,000 messages/hour to a single device.

What are the two types of messages in Firebase Cloud Messaging?

Using Firebase Cloud Messaging, we can send three types of messages, i.e., Notification Message, Data Message, and the message with both Notification & Data Payload.

Is Firebase good for push notifications?

Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web at no cost.


1 Answers

Update the version numbers of the Firebase libararies to be be consistent with the other Google Play Service libraries:

Change:

compile 'com.google.firebase:firebase-core:9.2.0'
compile "com.google.firebase:firebase-messaging:9.0.2"

To:

compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
like image 98
Bob Snyder Avatar answered Oct 13 '22 23:10

Bob Snyder