Support Topics Documentation Slack YouTube Blog

Unable to instantiate service com.backendless.push.BackendlessFCMService

I am getting issue on “unable to instantiate service com.backendless.push.BackendlessFCMService…” on device while send push push notification

My manifest file is as below:

<?xml version='1.0' encoding='utf-8'?>

attach manifest file, and show the full message please

AndroidManifest.xml (3.4 KB)

Please check once the manifest file

Can you please provide full error message

java.lang.RuntimeException: Unable to instantiate service com.backendless.push.BackendlessFCMService: java.lang.ClassNotFoundException: Didn’t find class “com.backendless.push.BackendlessFCMService” on path: DexPathList[[zip file “/data/app/com.test.APP-1/base.apk”],nativeLibraryDirectories=[/data/app/com.test.APP-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2942)
at android.app.ActivityThread.access$2100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.backendless.push.BackendlessFCMService” on path: DexPathList[[zip file “/data/app/com.test.APP-1/base.apk”],nativeLibraryDirectories=[/data/app/com.test.APP-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2939)
… 8 more
Suppressed: java.lang.ClassNotFoundException: com.backendless.push.BackendlessFCMService
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
… 10 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack tr

it seem that you do not include backendless android sdk, because android could not find the class BackendlessFCMService

I am using js sdk for backendless, i need to include android sdk too?

I have included ‘compile ‘com.backendless:backendless:5.2.4’’ in dependencies of app level gradle file now i am getting fallowing issue

java.lang.NoSuchMethodError: No virtual method toIntent()Landroid/content/Intent; in class Lcom/google/firebase/messaging/RemoteMessage; or its super classes (declaration of ‘com.google.firebase.messaging.RemoteMessage’ appears in /data/app/com.test.APP/base.apk)
at com.backendless.push.BackendlessFCMService.onMessageReceived(BackendlessFCMService.java:71)
at com.google.firebase.messaging.FirebaseMessagingService.zzl(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.zzJ(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source)
at com.google.firebase.iid.zzb$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

i’ve noticed misconfiguration in your manifest.

        <service android:name="com.backendless.push.BackendlessFCMService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

As i understood MyFirebaseMessagingService extends BackendlessFCMService.
And you should leave only one service.

means i need to remove service with “MyFirebaseMessagingService”

Actually to get the device token i have used " https://ionicframework.com/docs/v3/native/fcm", i think due to this the problem comes, can you suggest about this?

please suggest how to get device token for push notifications in js sdk?

The discussion have been continued in Slack.
In short words:
We have no solution for ionic framework. To receive device token you should use native code (our android sdk, written in Java). Or you may look for a solution yourself.

Presently i am using using js sdk, so i need to convert all things into android sdk?