B4A Library Admob Interstitial Library

Jaames

Active Member
Licensed User
Longtime User
You can easily set them to use the same jar. Just open the XML file of one of them. Scroll to the bottom and change the DependsOn node.

Thats true if we use old version Admob wrapper, but how to solve this if we use new one v2 which depends On google-play-services?
 

palmzac

Active Member
Licensed User
Longtime User
Thats true if we use old version Admob wrapper, but how to solve this if we use new one v2 which depends On google-play-services?

I have a same problem.

B4X:
PackageAdded: package:mobi.mindware.admob
main_globals (java line: 406)
main_globals (java line: 406)
java.lang.NoClassDefFoundError: mobi.mindware.admob.interstitial.AdmobInterstitialsAds
    at mobi.mindware.admob.main._globals(main.java:406)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
    at mobi.mindware.admob.main.initializeGlobals(main.java:263)
    at mobi.mindware.admob.main.afterFirstLayout(main.java:95)
    at mobi.mindware.admob.main.access$100(main.java:16)
    at mobi.mindware.admob.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NoClassDefFoundError: mobi.mindware.admob.interstitial.AdmobInterstitialsAds
    at mobi.mindware.admob.main._globals(main.java:406)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
    at mobi.mindware.admob.main.initializeGlobals(main.java:263)
    at mobi.mindware.admob.main.afterFirstLayout(main.java:95)
    at mobi.mindware.admob.main.access$100(main.java:16)
    at mobi.mindware.admob.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
 

jalle007

Active Member
Licensed User
Longtime User
I am unable to combine banner and Interstitials ads in one app.

I have referenced Admob 2.0 and mwAdInterstitial too.

the error is like this
B4X:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;

andy ideas, please?
 

palmzac

Active Member
Licensed User
Longtime User
Hi Jack,

It is a great library. Would you release a new version for Google Play Service ? Thanks !
 

jalle007

Active Member
Licensed User
Longtime User

I believe that this applies to Admob 1.40 that used Android SDK.
I really nee to implement Admob 2.0 (gms) with this library.

Tried many things, like altering xml files to point so same jar file but w/o success

Anyone have solution for this ?
 

Jack Cole

Well-Known Member
Licensed User
Longtime User
Did you try removing the <dependsOn> tag from the XML file? Try removing it either from the Admob library or interstitial library. It needs to be in one but not both.
 

jalle007

Active Member
Licensed User
Longtime User
Hi Jack

here is what I have

Admob.xml
<version>2.0</version>
<dependsOn>google-play-services</dependsOn>

mwAdmobInterstitial.xml
<version>1.1</version>
<author>Jack Cole</author>
<dependsOn>GoogleAdMobAdsSdk-6.4.1</dependsOn>

#AdditionalRes: c:\Users\jalle\Downloads\_Android\adt-bundle-windows-x86_64-20130917\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

I guess those are 3 files that interfere each other.
Tried removing <dependsOn> form mwAdmobInterstitial file but that did not help

B4X:
java.lang.NoClassDefFoundError: mobi.mindware.admob.interstitial.AdmobInterstitialsAds
  at com.jalle.pacdroid.main._globals(main.java:692)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
  at com.jalle.pacdroid.main.initializeGlobals(main.java:263)
  at com.jalle.pacdroid.main.afterFirstLayout(main.java:95)
  at com.jalle.pacdroid.main.access$100(main.java:16)
  at com.jalle.pacdroid.main$WaitForLayout.run(main.java:76)
  at android.os.Handler.handleCallback(Handler.java:615)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4905)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
  at dalvik.system.NativeStart.main(Native Method)

if I remove tag from Admob.xml get error also.
Do you have working sample of this setup ?
 

DavideV

Active Member
Licensed User
Longtime User
Hi Jack, thk you for your lib, i added it to my existing app and worked immediately.
Just a question, is there a way to center the ad in the activity? To be more clear, in my phone (4.3inch) the ad is almost centered in the screen as in your example in first post.
In my tablet (7inch) is displayed on top-left angle.
Maybe it depends on wich ad is received at that moment?
It would be nice to have it always centered into the activity.
Thank you again.
DavideV
 

tuhatinhvn

Active Member
Licensed User
Longtime User
can not use with admob 2.0
admob 1.4 will be removed from 1/8/2014

remove depends on tag:
B4X:
main_globals (java line: 331)

java.lang.NoClassDefFoundError: mobi.mindware.admob.interstitial.AdmobInterstitialsAds
    at mobi.mindware.admob.main._globals(main.java:331)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
    at mobi.mindware.admob.main.initializeGlobals(main.java:263)
    at mobi.mindware.admob.main.afterFirstLayout(main.java:95)
    at mobi.mindware.admob.main.access$100(main.java:16)
    at mobi.mindware.admob.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
    at dalvik.system.NativeStart.main(Native Method)

with depends on
B4X:
Parsing code.                          0.00
Compiling code.                        0.03
Compiling layouts code.                0.00
Generating R file.                      0.67
Compiling generated Java code.          1.06
Convert byte code - optimized dex.      Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
    at com.android.dx.command.dexer.Main.processClass(Main.java:486)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
    at com.android.dx.command.dexer.Main.access$400(Main.java:67)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
    at com.android.dx.command.dexer.Main.processOne(Main.java:418)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
    at com.android.dx.command.dexer.Main.run(Main.java:206)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
    Optimized dexer failed. Switching to Standard dexer.
 

Inman

Well-Known Member
Licensed User
Longtime User
can not use with admob 2.0
admob 1.4 will be removed from 1/8/2014

That is true. This library is working very well as of now. But on August 1st, Google will stop supporting Admob SDKs under 2.0. That means there won't be any ads from then on.

Jack, I hope you will soon make it compatible with Admob 2.x that uses google-play-services instead of GoogleAdMobAdsSdk-6.4.1.
 

rafaelbr20

Member
Licensed User
Longtime User
Hi Jack,

Thanks so much for this library ! I´m using it on my projects !

I´m waiting for a release also, because i can´t combine your library with Admob 2.x !

I hope you can release a new version !!

Rafael

I Got this error when compiling

B4X:
Convert byte code - optimized dex.      Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
    at com.android.dx.command.dexer.Main.processClass(Main.java:685)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    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:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at com.android.dx.command.dexer.Main.main(Main.java:199)
    at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting
    Optimized dexer failed. Switching to Standard dexer.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…