Android Question [SOLVED] Problem with the method CreateResourceFromFile

zolive33

Active Member
Licensed User
Longtime User
Hello,

The method "CreateResourceFromFile" seems not to work anymore like in B4A version 7.
Before update, this code worked very well :
B4X:
#If dvlp
   CreateResourceFromFile("google-services", "google-services-dvlp.json")
#Else if Premium
   CreateResourceFromFile("google-services", "google-services-premium.json")
#Else
   CreateResourceFromFile("google-services", "google-services.json")
#End If

Since update to B4A version 8.3, I have an error message during compilation.

Compiling code. Error
Error parsing manifest script:
Error parsing google-services.json:
Error parsing manifest script:
Error parsing json file. Make sure that the package name is correct.

Thank you for your help
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Seems like the json has an invalid format/content/Stucture

Are you sure the packagename in the json is idetical to the packagename in your app?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Start from the beginning.

I made following.
1) Created a new dummy project.
2) Changed build parameters
3) Copied google-services.json
4) Added to manifest
B4X:
CreateResourceFromFile (Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile (Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile (Macro, FirebaseNotifications.FirebaseNotifications)
Works fine.

Then I created google-services-premium.json and google-services-dvlp.json files and added to manifest your
B4X:
#If dvlp
   CreateResourceFromFile("google-services", "google-services-dvlp.json")
#Else if Premium
   CreateResourceFromFile("google-services", "google-services-premium.json")
#Else
   CreateResourceFromFile("google-services", "google-services.json")
#End If
No problems with compilation.
 
Upvote 0

zolive33

Active Member
Licensed User
Longtime User
Under B4A v7, I create new projet, 2 builds configurations, 2 projets in Firebase console. -> Compilation OK.
I update B4A to version V8.3 -> Compilation KO : "Error parsing json file. Make sure that the package name is correct."

Very Strange! :(

did you create 3 differents projects in Firebase?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You should use ONE Project at Firebase with multiple apps inside the Project.
In this case probably the three variants of your app.
AppA, AppB and AppC

Download the json for the PROJECT.
It does contain all Apps listed in the Project. You then can use a single json for all your apps using conditional compiling (each build has it´s own packagename which B4A can found in the json) to define the packagename.

You can use a single json for all three apps as the json contains all your Apps from the Firebase Project.

Edit to add: You still need the conditional compiling to change the packagename. But the json can be the same.
 
Last edited:
Upvote 0

zolive33

Active Member
Licensed User
Longtime User
Thank you DonManfred and Semen Matusovskiy, now It's very clear for me :).
I didn't understand that it was possible to create multiple applications on one project.

My problem is solved.

Best regards.
 
Upvote 0
Top