Support Topics Documentation Slack YouTube Blog

Unable to instantiate service com.backendless.push.BackendlessFCMService


(Rajasekhar Puligadda) #1

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'?>

(Sergey Kukurudzyak) #2

attach manifest file, and show the full message please


(Rajasekhar Puligadda) #3

AndroidManifest.xml (3.4 KB)

Please check once the manifest file


(Sergey Kukurudzyak) #4

Can you please provide full error message


(Rajasekhar Puligadda) #5

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


(Sergey Kukurudzyak) #6

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


(Rajasekhar Puligadda) #7

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


(Rajasekhar Puligadda) #8

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)


(Oleg Vyalyh) #9

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.


(Rajasekhar Puligadda) #10

means i need to remove service with “MyFirebaseMessagingService”


(Rajasekhar Puligadda) #11

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?


(Rajasekhar Puligadda) #12

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


(Oleg Vyalyh) #13

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.


(Rajasekhar Puligadda) #14

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