Android Question Notificationbuilder and service

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

I am using the pushservice example (https://www.b4x.com/android/forum/t...ion-gcm-framework-and-tutorial.19226/#content) and want a notificaton there.

B4X:
Sub MessageArrived (Intent As Intent)
    ...
    Dim nb As NotificationBuilder
    nb.initialize
    nb.SmallIcon="icon"
    nb.ContentTitle=title
    nb.ContentText=Data
    nb.DefaultLight=True
    nb.DefaultSound=True
    nb.DefaultVibrate=True
    nb.ContentInfo=""
    nb.subtext=""
    nb.setActivity(Me)
    nb.Notify(1) ' Here I get the error below:


** Service (pushservice) Start **
java.lang.RuntimeException: Unable to start service FB.Tag.pushservice@2a689d4 with Intent { cmp=FB.Tag/.pushservice (has extras) }: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/NotificationManagerCompat;
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3060)
at android.app.ActivityThread.access$2100(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5532)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/NotificationManagerCompat;
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:163)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at FB.Tag.pushservice.handleStart(pushservice.java:93)
at FB.Tag.pushservice.onStartCommand(pushservice.java:68)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3043)
... 9 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/NotificationManagerCompat;
at barxdroid.NotificationBuilder.NotificationBuilder.Notify(NotificationBuilder.java:512)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:712)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:244)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
... 13 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.NotificationManagerCompat" on path: DexPathList[[zip file "/data/app/FB.Tag-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 22 more
Suppressed: java.lang.ClassNotFoundException: android.support.v4.app.NotificationManagerCompat
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)
... 23 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
 

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you. I had an android-support-v4.jar file in my libs directory, but it must have been the wrong version. I replaced it with the newest one on my computer, now it works!
 
Upvote 0
Top