Implementing ads with admob

Hello everyone,

I followed these tutorials to add admob ads to my processing sketch:

https://forum.processing.org/two/discussion/16686/how-to-add-admob

I couldn’t put the second link here because of new user limitations but the title is: What are the exact steps to add AdMob to my app?

Thanks to akenaton and randomdude for your huge help.

My problem is that the ad doesn’t show up, the sketch launches on my device but there is no ad and I get this message:

BUILD SUCCESSFUL in 1m 6s
29 actionable tasks: 29 executed
[socket][0] connection pagead2.googlesyndication.com/2a00:1450:400d:803::2002:443;LocalPort=-1(60000)
[socket][/2001:4c4c:1163:e600:d864:c1d3:1814:1019:56794] connected
[OkHttp] sendRequest>>
[OkHttp] sendRequest<<
Wrong owner. Perhaps a late disconnect
close [socket][/2001:4c4c:1163:e600:d864:c1d3:1814:1019:56794]

Can somebody help me? Should I provide any of the source files?

Now it works. The problem was just a stupid mistake. I copied the wrong admob sample id.:flushed:

Great. Thxs for updating your post.

Kf

Hello, I’ve been having trouble with implementing admobs. If it isn’t too much trouble, I would appreciate it if you could link a project file of a blank sketch with just a banner ad. I’m not sure if the issue likes in my manifest, in the imported library, or because of some thing else. In any case, a project file would be really helpful to me!

Thank you in advance

https://drive.google.com/file/d/106YJchXlfUjKt_lB5Uw7GHKKLfmYCSzH/view?usp=sharing

Try this. It’s made from the two discussions I linked.

Thanks for the code.

The project built just fine, and it installed no problem. On it’s own, the sketch launched, and I could see the test ad. Unfortunately, after adding my game, I got this error:

:app:transformDexArchiveWithDexMergerForDebugDex: The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
    UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
	at com.android.dx.merge.DexMerger$8.updateIndex(DexMerger.java:565)
	at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276)
	at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:574)
	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:166)
	at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
	at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
	at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
 FAILED

I don’t understand why i’m getting this issue, because I have nowhere near 65536 methods in my sketch. Did you encounter this issue as well?

If anyone knows how to solve this, please help!

1 Like

Oh yes, sorry, I had that problem too for a few days. Just delete some files which are not needed from the com/google/android/gms folder in the jar file. You can try out what is the minimum needed for ads (I already did that, I can send you the smaller jar tomorrow if you need it). I just kept these files because maybe we will need something in the future for other stuff.

Can you link the edited jar file?

Edit: Never mind, everything is working now

Thanks for the help.

Boti, could you please add the modified jar file?, please

Hie.how could i implement video ads through processing for android? Please help

Hey .i have the same error integrating with my game…i tried implementing video ads for 1 week and failed … at least i want to implement this.help.help

Hey guys,

I came here to link an example project with working ads, but my old projects compile with errors now… I also never got the interstitial ads to work properly.

Also, this game (Come Play My Game!) that I released has rendering issues on some devices, so processing isn’t really a great solution if you want to make mobile games.

I suggest trying out Unity as an alternative, they make the integration of ads much easier.

Hope this helps!