Android Question [solved] Admob Integration error

Rajesh kannan MJ

Member
Licensed User
Longtime User
Hi,

UPDATE : The following issue is resolved. The recent version of Google Play Services seems requiring more memory while compiling. So, I set the MaxRamForDex to 1500 in b4aV0.1.ini file.

My version is 4.00

Admob version is 2.00

The google-play-services.jar file size is 4492kb(just thought I can share)

Downloaded the recent version of google-play-services.jar. Added in manifest and header of project too.

But I am getting this error when the app starts,


admob.png


Can any one or @Erel Can you please help on it?
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
Hi,

My version is 4.00

Admob version is 2.00

The google-play-services.jar file size is 4492kb(just thought I can share)

Downloaded the recent version of google-play-services.jar. Added in manifest and header of project too.

But I am getting this error when the app starts,


View attachment 33805

Can any one or @Erel Can you please help on it?
did you copy the latest google_play_srevices.jar file into your additional libraries folder?
did you add the resources folder to your project and added this to your project?
B4X:
#AdditionalRes: C:\android-sdk-windows\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

Cheers,
Walter
 
Upvote 0

Rajesh kannan MJ

Member
Licensed User
Longtime User
@walterf25 Yes, I did that,

Copied the latest google_play_services.jar to the additional libraries folder.

Added resource with #additionalRes: line.

I am facing another issue too. It takes abnormal time to compile. Sometimes 2 minutes and crashes. Also it says, switching to another compiler or something like that.

Thank you,
 
Upvote 0

Rajesh kannan MJ

Member
Licensed User
Longtime User
@NJDude ok I will do that and reply the feedback here.

But Before that, I have even restarted B4A often, does not that count?

Anyways, I will refresh and get you back here,

Thank you,
 
Upvote 0

Rajesh kannan MJ

Member
Licensed User
Longtime User
B4X:
Parsing code.                           0.01
Compiling code.                         0.33
Compiling layouts code.                 0.01
Generating R file.                      1.19
Compiling generated Java code.          4.90
Convert byte code - optimized dex.      Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.lang.StringBuilder.toString(StringBuilder.java:407)
    at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
    at com.android.dx.rop.code.Rops.ropFor(Rops.java:1210)
    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:490)
    at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691)
    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:764)
    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787)
    at com.android.dx.cf.code.Ropper.doit(Ropper.java:742)
    at com.android.dx.cf.code.Ropper.convert(Ropper.java:349)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:729)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
    Optimized dexer failed. Switching to Standard dexer.

This is what is shown in the compiler box now,
 
Upvote 0

Rajesh kannan MJ

Member
Licensed User
Longtime User
@Erel Thanks. It is now solved.

I set the RAM level to 1500 in the b4aV0.1.ini

The file generally resides at C:\Users\<user name>\AppData\Roaming\Anywhere Software\Basic4android\b4aV0.1.ini

by setting MaxRamForDex to 1500

BTW , Erel, When the B4A is open and if I edit the ini file and add the value, it does not get stored. I mean actually it seems B4A keeps the old ini in RAM or somewhere and while closing it rewrites the INI with the RAM stored values. It is just for you.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Erel, When the B4A is open and if I edit the ini file and add the value, it does not get stored. I mean actually it seems B4A keeps the old ini in RAM or somewhere and while closing it rewrites the INI with the RAM stored values. It is just for you.
This is the expected behavior. B4A writes the ini file when it is closed. It doesn't monitor the file for changes.
 
Upvote 0
Top