Android Question Firebase integration problem

Toky Olivier

Active Member
Licensed User
Longtime User
Hello,
I tried to intregrate Firebase in my application but every time, it crashes before it shows the main activity.

I followed this tuto: https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/

What else should I install with SDK Manager? I have installed Google play services (Version 46) (there is no recommanded items in B4A SDK Manager as said in the tutorial).

Firstly, when compiling, there is an error:

B4X:
B4A version: 6.80
Parsing code.    (0.00s)
Compiling code.    (0.02s)
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
Generating R file.    Error
AndroidManifest.xml:28: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

When I insert
B4X:
#AdditionalJar: com.google.android.gms:play-services-base
in my code, i can compile it but the application crashes when starting.
B4X:
LogCat connected to: emulator-5554
--------- beginning of main
--------- beginning of system
--------- beginning of crash

I enclosed the sample project.
 

Attachments

  • firebase integration.zip
    8.8 KB · Views: 162

DonManfred

Expert
Licensed User
Longtime User
make sure the packagename of your app matches the packagename in the json
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
Hi all,

make sure the packagename of your app matches the packagename in the json
They are the same.

Can you post the error message?
The error message is: "Unfortunately, B4A Example has stopped".

Please see enclosed error message and the sample project.

Thank you so much.
 

Attachments

  • FirebasePblm.png
    FirebasePblm.png
    73.8 KB · Views: 177
  • firebase integration.zip
    9.3 KB · Views: 152
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
You did NOT added any Firebase Library to your project.
To test i added Firebasemessaging and i got no crash!

Ah, Ok, I don't know it. Thank you so much DonManfred.
May be Erel need to update a little bit the tutorial:
- Add this in the code :
B4X:
#AdditionalJar: com.google.android.gms:play-services-base
- Add at least one Firebase Library to the project...

Thank you all.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Ah, Ok, I don't know it. Thank you so much DonManfred.
May be Erel need to update a little bit the tutorial
why? It makes no sense to follow the firebase-installation instructions if you do not add any firebase Library to your project!
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
why? It makes no sense to follow the firebase-installation instructions if you do not add any firebase Library to your project!
OK, sorry . It's the 5th step in the tutorial then.

But finally, my problem is not solved :confused:. There is an error of compilation when I integrate Firebase in my project.
B4X:
B4A version: 6.80
Parsing code.    (0.17s)
Compiling code.    (0.57s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.04s)
Organizing libraries.    (3.60s)
Generating R file.    (2.56s)
Compiling generated Java code.    (11.67s)
Convert byte code - optimized dex.    Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.android.dx.ssa.DomFront.<init>(DomFront.java:66)
    at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:296)
    at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:51)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
    at com.android.dx.command.dexer.Main.processClass(Main.java:613)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
    at com.android.dx.command.dexer.Main.access$2(Main.java:546)
    at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:537)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
    at com.android.dx.command.dexer.Main.run(Main.java:206)
    at com.android.dx.command.dexer.Main.main(Main.java:179)
    at com.android.dx.command.Main.main(Main.java:103)
Picked up _JAVA_OPTIONS: -Xmx512M

I tried to change Process Timeout but I still cannot compile my project...
I don't know what happend, with the Sample project, it works.
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
This is a different error. You need to increase MaxRamForDex: https://www.b4x.com/search?query=MaxRamForDex

I increased MaxRamForDex from 1024 to 2048 but the error remains.

B4X:
B4A version: 6.80
Parsing code.    (0.14s)
Compiling code.    (0.39s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.03s)
Organizing libraries.    (2.57s)
Generating R file.    (1.08s)
Compiling generated Java code.    (7.58s)
Convert byte code - optimized dex.    Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
    at com.android.dx.ssa.Dominators$DFSInfo.<init>(Dominators.java:282)
    at com.android.dx.ssa.Dominators$DfsWalker.visitBlock(Dominators.java:259)
    at com.android.dx.ssa.SsaMethod.forEachBlockDepthFirst(SsaMethod.java:783)
    at com.android.dx.ssa.Dominators.run(Dominators.java:185)
    at com.android.dx.ssa.Dominators.make(Dominators.java:90)
    at com.android.dx.ssa.DomFront.run(DomFront.java:86)
    at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:297)
    at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:51)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
    at com.android.dx.command.dexer.Main.processClass(Main.java:613)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
    at com.android.dx.command.dexer.Main.access$2(Main.java:546)
    at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:537)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
    at com.android.dx.command.dexer.Main.run(Main.java:206)
    at com.android.dx.command.dexer.Main.main(Main.java:179)
Picked up _JAVA_OPTIONS: -Xmx512M

I don't know to do.
Thank you so much.
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
Start a new thread and post the project (File-Export as zip)

All i can say; i used your project and added firebase messaging to the project from here.
It compiles fine here
It works fine also with an empty project (the one I uploaded) but when I integrate firebase in my own project.
May be my 6Go of ram is not sufficient. For now, ...I give up. I'll use firebase in a fresh new project.
Thank you all.
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
Update:
After modifying :
- Process Timeout = 120
- MaxRamForDex = 5120
And Deleting: _JAVA_OPTIONS environment system variable
It works now with the Standard Dexer (not with the optimized one).

Thank you all.
 
Upvote 0
Top