I am using the code below from a long time. I just came back to it after few months and I noticed that I am getting the error below
B4X:
(IllegalArgumentException) java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
The error is caused by
B4X:
Dim cTokenID As String = fm.Token
The actual code is here
B4X:
Public Sub SubscribeToTopics2( lstTopics As List)
If Not(fm_IsInitialized) Then
Return
End If
Dim i As Int
For i = 0 To lstTopics.Size - 1
fm.SubscribeToTopic(lstTopics.Get(i))
Next
'fm.SubscribeToTopic("general")
#if B4A
Try
Dim cTokenID As String = fm.Token 'This line generates the error
LogColor("Passed",Colors.Blue)
Catch
LogColor("Crashed",Colors.Blue)
End Try
#end if
End Sub
I tried using the exact same package name and the exact same json file in a sample project, but I don't see the issue.
Erel, thanks for your reply.
Please note that I have done that multiple times. if you insist I'll do it again, but if the issue is the android SDK, why would one project execute the same line of code ok while the other doesn't?
1. Forcing your app to use Android 4 theme is a mistake (SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")).
2. targetSdkVersion should be 29.
I don't see the cause of this error in the manifest. Make some tests. Make a copy of the project and remove everything from the manifest editor except of the firebase + google play related lines.
I assume that you are using the latest version of B4A with the latest version of Android SDK + components (don't open B4A Sdk Manager at all).
Not opening the SDK manager at all is not an option at all. I have tried this several times, and every time something is missing.
Also as I mentioned before, the sample project that I built to simulate the issue has the exact same B4A manifest file now, but I don't see the problem
I am getting an Error Message on App Startup Stating Logs like W/Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: { "...
stackoverflow.com
I would create a new package name in firebase , download the new google-services.json and use that one in the android app.
Thanks for your feedback:
1. I would be worried about changing the package name as the app is in production
2. The same package name works in a different project
Yes, shouldn't change the package name of a production app
Did you try re-download the google-services.json from the appropriate firebase project?
I also had a problem once where the firebase file had been copied to both the main project directory and the files directory by mistake which caused some problems as well.
The issue was this:
I had a readonly flag set on the "res" folder to prevent the compiler from overwriting the application icon (I believe this was an issue long time ago)
Deleting the "objects" folder resolved the issue
But I am still not sure why and how the problem started. I always had this flag on.