Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Admob class not found - Gideros Forum

Admob class not found

HolonistHolonist Member
edited March 2017 in Bugs and issues
Hi community,

after failing for two days straight to set up a working build with Ads Interface manually, I was happy it's an option in the APK export.

My app crashes when I add ads code in my main.lua.
require 'ads' // this line is ok

admob = Ads.new("admob") // crashes this line is ok
admob:setKey("pub-xxxxxxxxxxxx") // crashes (replaced my id with X here, I use my real ID of course)

The gideros APK build finishes nicely, but in the middle I get this message:
Note: C:\Users\Holon\Desktop\zen11\zendataminer\tmp\app\src\main\java\com\giderosmobile\android\plugins\ads\Ads.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Do I have to do something about this?

Help please :( Thank you

I added the relevant logcat excerpt from my bluestacks emulator.
W/System.err(11799): java.lang.ClassNotFoundException: com.giderosmobile.android.plugins.ads.frameworks.AdsAdmob

W/System.err(11799): at java.lang.Class.classForName(Native Method)

W/System.err(11799): at java.lang.Class.forName(Class.java:251)

W/System.err(11799): at java.lang.Class.forName(Class.java:216)

W/System.err(11799): at com.giderosmobile.android.plugins.ads.Ads.initialize(Ads.java:205)

W/System.err(11799): at com.giderosmobile.android.player.GiderosApplication.nativeDrawFrame(Native Method)

W/System.err(11799): at com.giderosmobile.android.player.GiderosApplication.onDrawFrame(GiderosApplication.java:669)

W/System.err(11799): at com.giderosmobile.android.GiderosRenderer.onDrawFrame(zendataminerActivity.java:407)

W/System.err(11799): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)

W/System.err(11799): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

W/System.err(11799): Caused by: java.lang.NoClassDefFoundError: com/giderosmobile/android/plugins/ads/frameworks/AdsAdmob

W/System.err(11799): ... 9 more

W/System.err(11799): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.giderosmobile.android.plugins.ads.frameworks.AdsAdmob" on path: DexPathList[[zip file "/data/app/com.treasurebyte.dataminer-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.treasurebyte.dataminer-2, /system/lib, /system/lib/arm, /data/downloads]]

W/System.err(11799): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

W/System.err(11799): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)

W/System.err(11799): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)

W/System.err(11799): ... 9 more

W/dalvikvm(11799): threadid=10: thread exiting with uncaught exception (group=0x9cd49b20)

D/BstCommandProcessor-Application( 9660): Application crash has been observed.


  • Ok I just realized I also have to check Google Play services Plugin and within the Ads Plugin, Admob....

    But the problems stay exactly the same
  • @Holonist I usually do this manually, so I could help you with that. Are you exporting to Android Studio?
  • @simwhi yes, if it has to be manual, android studio. Do you use admob too?
  • antixantix Member
    Accepted Answer
    @Holonist, if you see my recent thread... http://giderosmobile.com/forum/discussion/6871/adverts-with-new-plugin-system#Item_6

    Admob isn't quite working how it should right now. I have tested the fix by @hgy29 and it works. Maybe he can PM you a link to the RC which you can use to get you working again.

    Wjilst Admob wasn't working for me, I went and did the gaming plugin stuff (which works) like leaderboards and achievements :)
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • simwhisimwhi Member
    edited March 2017
    @Holonist Here's a link to an Android Studio project without any assets. Use this to help build your project. The following plugins are included:

    1) IAB
    2) Facebook
    3) Flurry
    4) AdMob

    Let me know if you require any clarifications.


    Likes: Holonist

    +1 -1 (+1 / -0 ) Share on Facebook
  • HolonistHolonist Member
    edited March 2017
    @antix It seems my Ads.java file is not included at all, so none of the ad plugins should work. Strange thing is I only get a 'Note:' when compiling, but apparently it decides to go just not include the file at all. Will look at the thread soon though.

    @Simwhi Will try it once I get home (in about 8 hours). Thanks
  • antixantix Member
    @Holonist, strange indeed. It was only the admob that wouldn't work for me.
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • @Simwhi Can't manage to open your project properly. It whines about wrong sdk versions etc, even though I have them installed. And on fixing one message, two new ones appear. I'll update my Android Studio and try again with a clean export
  • hgy29hgy29 Maintainer
    @Holonist, your error log indicates that Ads.java is actually included.

    Likes: antix

    +1 -1 (+1 / -0 ) Share on Facebook
  • Yes I'm seeing it. I was sure it said Ads and not admob... Maybe I should just give up before I go crazy. I got a build running with applovin. But my app simply won't show up in their interface.
    Must the app be started from an apk that's actually downloaded from the store? Otherwise I'm not sure how they would even fetch my app id. Idk I'm just done right now
  • antixantix Member
    edited March 2017
    @Holonist so you have uploaded your app to the store?

    I uploaded my app as a beta in Google Play Store. I made my AdMob stuff but couldn't link it because AdMob couldn't find it. When I searched for my name though (antix development) it could find my app that way. Maybe AppLovin works in a similar way?

    Also I am finding the export capabilities in Gideros Studio improving immeasurably all the time. It can do all the advert plugin crap for you and you don't even need Android Studio, except for when you want to see stuff your app might print using LogCat :)

    The next release (soon I think) will contain the fixed admob functionality in ads plugin too :bz

    Likes: Holonist

    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
    +1 -1 (+1 / -0 ) Share on Facebook
  • HolonistHolonist Member
    edited March 2017
    AppLovin doesn't even offer a way to search an app. For every action they redirect you to their tutorial how to integrate their sdk (which I did). They say once you've done this, the app will appear. I guess the app has to be uploaded to the store then.. Can just hope this only applies for the first time. If I have to upload an apk every single time I want to test a change I'm going to quit and become a gardener!
  • antixantix Member
    edited March 2017
    @Holonist, hmm. Okay what I do is include all the things needed to use ads in my app and then upload an APK to the play store and publish it in BETA mode.

    Once the app can be located by admob or applovin then you can just export and test on your own devices until you have it how you want. Then you can upload a new APK.

    I hope that makes some sense :)

    Oh, and Gideros Studio exports an APK maybe 1000 times faster than poor old Android Studio :D
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • Do I need to set up a google API btw? Just for ads I mean
  • @Holonist Sorry to hear that you are experiencing issues with my project. Can you not just use the build tools / sdk versions you have install on your machine?

    Here's an example of my build.gradle file.
    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.3"
        defaultConfig {
            applicationId "com.wobblemonkey.grammarsmash"
            versionCode 111
            versionName "1.1.1"
            minSdkVersion 15
            targetSdkVersion 22
        signingConfigs {
            release {
                //storeFile file("jksgid_StoreFile")
                storePassword "jksgid_StorePass"
                keyAlias "jksgid_KeyAlias"
                keyPassword "jksgid_KeyPass"
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
                //signingConfig signingConfigs.release
    repositories {
    //    flatDir {
    //        dirs 'libs'
    //    }
    dependencies {
        compile files('libs/gideros.jar')
        compile 'com.google.android.gms:play-services-auth:10.2.0'
        compile 'com.google.android.gms:play-services-base:10.2.0'
        compile 'com.google.android.gms:play-services-identity:10.2.0'
        compile 'com.google.android.gms:play-services-location:10.2.0'
        compile 'com.google.android.gms:play-services-ads:10.2.0'
        compile 'com.google.android.gms:play-services-places:10.2.0'
        compile 'com.google.android.gms:play-services-games:10.2.0'
        compile 'com.google.android.gms:play-services-safetynet:10.2.0'
        compile 'com.google.android.gms:play-services-wallet:10.2.0'
        compile 'com.facebook.android:facebook-android-sdk:3.23.1'
        compile files('libs/flurry-analytics-6.5.0.jar')
  • antixantix Member
    edited March 2017
    Do I need to set up a google API btw? Just for ads I mean
    I don't quite get you, do you mean a store listing? or something else?
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • I attached a screenshot. It looks like the Play Services plugin requires additional input. And to get an API key you have to activate some google apis. An app can be published completely fine without this, but now I wonder if its needed for the plugins to work
    744 x 390 - 19K
  • Got the export with Admob to work now! I replaced
    C:\Program Files (x86)\Gideros\All Plugins\ads\ads.gplugin with the content of this


    Now I have to make sure my ad settings are correct in Google Play.
  • HolonistHolonist Member
    edited March 2017
    Ok so I uploaded an apk to beta, with working admob plugin, downloaded it on my device.

    In my main.lua I have
    require 'ads'
    admob = Ads.new("admob")
    admob:setKey("ca-app-pub-12345678901234~12345678") //this time the correct format (I hope?)

    In Google Developers, I added the info that my app contains ads. (Didn't do anything else though)

    In admob, I created an ad unit (banner).

    I don't see any ads in my beta. Do I need more code for positioning the ad? Or adding it to the stage? And do I need to do something with the Ad Unit Id? Or is this taken care of automatically?

    SORRY i've just seen in http://docs.giderosmobile.com/interface/ads -> METHODS that the ad unit ID has to be handed as second parameter to showAd().

    But under the code example it does NOT include a second parameter. Please fix the example
  • I can now show test ads. But if I remove admob:enableTesting() I get:

    Does this mean its dismissed by the player? Or by the ad provider (because I run on a beta or undeployed APK)?
  • antixantix Member
    edited March 2017
    @Holonist, you need to load an advert before you can show it? I'm using admob for ads. I make the admob global in my main.lua..
    require "ads"
    admob = Ads.new("admob")
    admob:addEventListener(Event.AD_RECEIVED, function()
      admob:setAlignment("center", "bottom")
    admob:addEventListener(Event.AD_FAILED, function(e) end)
    admob:addEventListener(Event.AD_ACTION_BEGIN, function() end)
    admob:addEventListener(Event.AD_ACTION_END, function() end)
    admob:addEventListener(Event.AD_DISMISSED, function() end)
    When my game scene starts I just have the following line of code..
    admob:loadAd("banner", ADMOB_UNIT_ID)
    So it makes admob load an add and when the ad has been loaded the AD_RECEIVED event makes it show.

    That's my entire ads code. Maybe you can add that to your game and see if it works?

    You will have to make two global variables, ADMOB_APP_ID and ADMOB_UNIT_ID, or just write your id's in place of them :)

    Oh, I never bother with the enableTesting() thing, I always just use the actual thing.

    Likes: Holonist

    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
    +1 -1 (+1 / -0 ) Share on Facebook
  • HolonistHolonist Member
    edited March 2017
    I'm almost certain loadAd() is not required and you can just use showAd() with the same parameters. At least it says so in gideros ad interface documentation. I will try it with loadad and the ad_received event anyway this evening.

    As I said, I got it to work just fine with test ads, which should mean live ads would work with my code, I believe. I published my app to production 10 hours ago with live ads code, but nothing shows up. I read about admob taking a while to deliver ads after setting up an ad unit, but it should be enough time now (about 12 hours)
  • totebototebo Member
    edited March 2017
    I wouldn't be so sure, sometimes it can take a while for real ads to show. The app shouldn't have to be "live" though, you should be able to see real ads in the player (if you've built a player with the ad plugin included).

    Likes: Holonist, antix

    My Gideros games: www.totebo.com
    +1 -1 (+2 / -0 ) Share on Facebook
  • antixantix Member
    @Holonist, I agree with @totebo. It is best to use loadAd and then when there is actually something available the event will display it.

    Also I don't know about time. I was having trouble getting the ads to work and it was two days before I got round to testing. I know that admob and play store are so slow. One of my games took over 30 hours to appear in the store after publishing it!
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • HolonistHolonist Member
    edited March 2017
    Ok then, now I use loadAd and a 5000ms Timer.delayedCall to show the ad.
    However I instantly get AD_DISMISSED event and none after that.

    My logcat on Bluestacks looks like this:
    I/Ads ( 4190): Starting ad request.
    I/Ads ( 4190): Use AdRequest.Builder.addTestDevice("3EEFE79C796F2970275061CD
    C90A5D94") to get test ads on this device.
    W/Herrevad( 1816): [199] qim.a: On wifi, but couldn't get security type
    I/Ads ( 1816): Received log message: You are using version 9.3
    of the Google Play services Ads SDK. Please consider updating your SDK to the m
    ost recent SDK version to get the latest features and bug fixes. See http://goo.
    gl/r2TRzC for instructions on how to get the latest version of Google Play servi
    W/Ads ( 1816): Received error HTTP response code: 403
    W/Ads ( 4190): There was a problem getting an ad response. ErrorCode: 0
    W/Ads ( 4190): Failed to load ad: 0

    Does anyone know what 403 stands for in this context?

    Edit: I cannot include higher than Google Play services 9.2.0, otherwise I get this nice error when doing direct export: AndroidManifest.xml:7:5-73 Error:
    uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services-ads:10.2.0]

    Edit2: Compiled apk in AS with Google Play services 10.2.0, didn't solve it

    Guess I'll just wait.
  • antixantix Member
    @Holonist maybe you could try exporting direct to APK from Gideros Studio. It should handle all of that junk.
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
Sign In or Register to comment.