Android Question Problem with FirebaseNotifications

ilan

Expert
Licensed User
Longtime User
Hi

after updating everything in the sdk manager and using b4a 8.80 i cannot build my apps.
all apps gives me the same error with my firebase implementation.

*** Service (starter) Create ***
shared: /storage/emulated/0/Android/data/www.sagitalcashliteeng.net/files/shared
Starter Create
** Service (starter) Start **
5
shabbat = false
Starter Start
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
firebasemessaging_subscribetotopics (java line: 302)
java.lang.NoSuchMethodError: No virtual method subscribeToTopic(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/messaging/FirebaseMessaging; or its super classes (declaration of 'com.google.firebase.messaging.FirebaseMessaging' appears in /data/app/www.sagitalcashliteeng.net-YvV24f8cdMbYXhN-uY_6DA==/base.apk)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
at www.sagitalcashliteeng.net.firebasemessaging._subscribetotopics(firebasemessaging.java:302)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1164)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

what should i do to fix it? i already removed firebase notifications on some of my apps that i had to update and upload a build but i really would like to have firebase working on my apps.

thanx
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
- Post the versions of firebaseauth, firebaseNotification and FirebaseAnalytics.

fb.jpg


- Post your manifestcode

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap,"true")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'SetActivityAttribute(game, android:screenOrientation, "landscape")
 
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="shared" />
)


SetApplicationAttribute(android:theme, "@style/LightTheme")
'CreateResource(values-v20, theme.xml,
'<resources>
'  <style
'     name="LightTheme" parent="@android:style/Theme.Material.Light">
'     <item name="android:windowFullscreen">true</item>
'  </style>
'</resources>
')
CreateResource(values-v14, theme.xml,
<resources>
  <style
     name="LightTheme" parent="@android:style/Theme.Holo.Light">
     <item name="android:windowFullscreen">true</item>
  </style>
</resources>
)

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
i have also tried to remove my app from firebase console and add it again like mentioned here: https://www.b4x.com/android/forum/threads/beginning-of-crash.93837/#post-594589

but it also didnot help. i still get the error.

*** Service (starter) Create ***
5
shabbat = false
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
895982
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
subscribe to topics called
firebasemessaging_subscribetotopics (java line: 355)
java.lang.NoSuchMethodError: No virtual method subscribeToTopic(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/messaging/FirebaseMessaging; or its super classes (declaration of 'com.google.firebase.messaging.FirebaseMessaging' appears in /data/app/www.sagital.buysmart-88ms0VPkowRTyLSA3dZnRQ==/base.apk)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
at www.sagital.buysmart.firebasemessaging._subscribetotopics(firebasemessaging.java:355)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1164)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
This errors means that you are using an old version of Firebase SDK. Make sure that android.jar is configured correctly under Tools - Configure Paths.

this is what i have:

androidjar.png


is this an old version?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
this is what i have
You android jar path does not match the path of the SDK you are using in the SDK Manager.
So you are using an old SDK in the IDE it seems.

Change android.jar to be C.\Android\platforms\android-28\android.jar
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
You android jar path does not match the path of the SDK you are using in the SDK Manager.
So you are using an old SDK in the IDE it seems.

Change android.jar to be C.\Android\platforms\android-28\android.jar

you are a genius @DonManfred. thank you very much. now i can build my app again and send lots of spam to all users :p
 
Upvote 0
Top