Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
error with admob and GPS 21.5.0 in apk — Gideros Forum

error with admob and GPS 21.5.0 in apk

Help please.

I am using Admob with the ads plugin configured with google play services 21.5.0

my application runs fine in the pc player and also in the android player.

When I export to APK or ABB it exports everything fine.

Then I install the APK on android and when running it immediately exits with an apk error.

I am using the latest gideros 2023.2
ads with gps 21.5.0

the "gaming" plugin does not accept google play services 21.5.0, so I use it with 16.0.0 or it also accepts 20.0.0

my app works fine on pc player and android player but the installed apk gets exited immediately. it only shows the initial gideros logo.


(It is similar to a problem that I read here in the forum when you use, for example, a .jpg file and it has a upper case letter, eg ".JPg" works fine in the player and in the android player, but nothing works in the installed APK)


This is my APK for testing, I made it super simple, just use an image and the ads plugins with 21.5.0 and gaming with 20.0.0
fondo = Bitmap.new(Texture.new("play.png", true))
fondo:setPosition(110,110)
fondo:setScale(2)
stage:addChild(fondo)

the APK is broken I tried it on android 7 and android 9

Can someone please confirm if it doesn't run?

someone was able to use ADMOB with 21.5.0 and was able to upload a real ABB or APK to google play?

(I went up to google play and I just realized that the installed one does not run)

this is my apk

It won't let me upload the APK file because of the size, but it looks like this:






generates the APK well, works on pc player and android player

but the installed APK is broken immediately










I tried it with several configurations, but the installed one always breaks.
It exports fine but the installed apk doesn't run. try removing plugin JSON, REQUIRE, etc...


please @hgy29 Could I test if an installed APK can run or is it broken or what am I doing wrong?

Thanks in advance.




Comments

  • MoKaLuxMoKaLux Member
    edited March 2023
    rodri said:

    (It is similar to a problem that I read here in the forum when you use, for example, a .jpg file and it has a upper case letter, eg ".JPg" works fine in the player and in the android player, but nothing works in the installed APK).

    To avoid such problems be sure to put all your assets in the assets folder in the file explorer (not where the .gproj file is). Your play.png file when you click it in Gideros Studio should show assets/play.png.

    I haven't tested ads plugin in a long time but it seems you are putting the ca-app-pub-... in the wrong field?!

    To further test why it is not working you can plug your phone (via cable or wifi) in Android Studio and look at the debug logs that should tell you exactly where your app fails.

    Hope this can help.
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    @rodri, the best thing to do to diagnose such issues on android is to capture android logs (logcat) with Android Studio as @MoKaLux said. The log is very verbose, but gideros will report lua issues here, and android will report application crashes here too. It is better to have a look at it then just guessing. If you post it here (or PM it to me) I'll be able to help.
  • rodrirodri Member
    @hgy29 , thanks for your help

    here is the logcat of android studio.

    It is the extract where the application breaks...
    2023-03-08 22:11:34.994  8741-8741  AndroidRuntime          pid-8741                             E  FATAL EXCEPTION: main
                                                                                                        Process: com.yourdomain.yourapp, PID: 8741
                                                                                                        java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
     
                                                                                                        ******************************************************************************
                                                                                                        * Invalid application ID. Follow instructions here:                          *
                                                                                                        * h ttps://googlemobileadssdk.page.link/admob-android-update-manifest         *
                                                                                                        * to find your app ID.                                                       *
                                                                                                        * Google Ad Manager publishers should follow instructions here:              *
                                                                                                        * h ttps://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
                                                                                                        ******************************************************************************
     
     
                                                                                                        	at android.app.ActivityThread.installProvider(ActivityThread.java:6483)
                                                                                                        	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6072)
                                                                                                        	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6011)
                                                                                                        	at android.app.ActivityThread.-wrap3(ActivityThread.java)
                                                                                                        	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1714)
                                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                        	at android.os.Looper.loop(Looper.java:154)
                                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:6836)
                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
                                                                                                        Caused by: java.lang.IllegalStateException: 
     
                                                                                                        ******************************************************************************
                                                                                                        * Invalid application ID. Follow instructions here:                          *
                                                                                                        * h ttps://googlemobileadssdk.page.link/admob-android-update-manifest         *
                                                                                                        * to find your app ID.                                                       *
                                                                                                        * Google Ad Manager publishers should follow instructions here:              *
                                                                                                        * h ttps://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
                                                                                                        ******************************************************************************
     
     
                                                                                                        	at com.google.android.gms.ads.internal.client.zzek.attachInfo(com.google.android.gms:play-services-ads-lite@<a href="https://forum.gideros.rocks/profile/21" rel="nofollow">@21</a>.5.0:15)
                                                                                                        	at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@<a href="https://forum.gideros.rocks/profile/21" rel="nofollow">@21</a>.5.0:1)
                                                                                                        	at android.app.ActivityThread.installProvider(ActivityThread.java:6480)
                                                                                                        	... 10 more
    2023-03-08 22:11:34.995 11559-11559 ImageWallpaper          pid-11559                            D  onVisibilityChanged: mVisible=true visible=false
    2023-03-08 22:11:34.995 11559-11559 ImageWallpaper          pid-11559                            D  Visibility changed to visible=false
    2023-03-08 22:11:34.996  2887-1860  Debug                   pid-2887                             D  !<a href="https://forum.gideros.rocks/profile/DumpState" rel="nofollow">@DumpState</a> : SHIP
    2023-03-08 22:11:34.996  2887-1860  Debug                   pid-2887                             D  !<a href="https://forum.gideros.rocks/profile/DumpState" rel="nofollow">@DumpState</a> : debug level:0x4f4c
    2023-03-08 22:11:34.996  2887-1860  Debug                   pid-2887                             D  !<a href="https://forum.gideros.rocks/profile/Dumpstate" rel="nofollow">@Dumpstate</a> : Finally, system will skip dumpstate
    2023-03-08 22:11:34.997  2887-1860  ActivityManager         pid-2887                             W    Force finishing activity com.yourdomain.yourapp/com.giderosmobile.android.holamundoActivity
    2023-03-08 22:11:34.997  2887-1860  MultiScree...gerService pid-2887                             W  moveTaskBackToDisplayIfNeeded(): root is not base activity
    2023-03-08 22:11:35.000  2887-1860  ActivityManager         pid-2887

    The app crashes as soon as it starts.
    but in the gideros player it shows even the test advertising..

    Please if you can help me find what is wrong.
  • rodrirodri Member
    edited March 2023
    I think you can't see the log

    I send it in this file please to review better...

    (
    sorry, it won't let me send a file and it was posted twice...
    I'll see how to send the log...)
  • rodrirodri Member
    I think you can't see the log

    I send it in this file please to review better...

  • MoKaLuxMoKaLux Member
    edited March 2023
    I see you are loading App Open ads (https://developers.google.com/admob/android/test-ads) I am not sure Gideros supports it?!
    Can you try with a simple Banner ad?
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • rodrirodri Member
    MoKaLux said:

    I see you are loading App Open ads (https://developers.google.com/admob/android/test-ads) I am not sure Gideros supports it?!
    Can you try with a simple Banner ad?

    hello,

    Yes, I did tests with banner

    In gideros player I get like this:




    but the installed APK is broken with that logcat that I posted..


    In the plugin I only put the "application id", I put the banner codes by code.

    as I show here, but this was just for testing.

    i use something like this:
    ------------------------ads
     
     
       self.ADMOB_APP_ID = "ca-app-pub-3940256099942544/3419835294" 
       self.ADMOB_UNIT_ID = "ca-app-pub-3940256099942544/6300978111" 
     
       -- admob (setup for simple banner adverts), note: only visible on phone/tablet
       if application:getDeviceInfo() == "Android" then
          require 'ads' --create real object for on device
     
          self.ADMOB = Ads.new('admob')
    	   --self.ADMOB:enableTesting(true)
     
     
          self.ADMOB:setKey(self.ADMOB_APP_ID)
          self.ADMOB:addEventListener(Event.AD_RECEIVED, function(e) -- show ad
            if e.type=="banner" then
    		--self.ADMOB_cargado=true
    		 self.ADMOB:showAd('banner')
             self.ADMOB:setAlignment('center', 'bottom')
             --self.ADMOB:setAlignment('center', 'top')
    		 --print ("banner recibido")
    		 end
          end)
         -- self.ADMOB:addEventListener(Event.AD_FAILED, function(e) end)
         -- self.ADMOB:addEventListener(Event.AD_ACTION_BEGIN, function() end)
         -- self.ADMOB:addEventListener(Event.AD_ACTION_END, function() end)
         -- self.ADMOB:addEventListener(Event.AD_DISMISSED, function() end)
     
    	  self.ADMOB:loadAd("banner", self.ADMOB_UNIT_ID)
    	  --print ("banner requerido")
       else
          self.ADMOB = {} -- create fake object for testing in windows player
          self.ADMOB.loadAd = function() end
          self.ADMOB.showAd = function() end
       end
     
     
     
    ----------------------end ads


    Actually I always did it like this... I already have games uploaded to google play from the previous year, but I used gideros 2022.12 and google play services 16.0.0

    and I use banners, interstitials and rewarded, they work well.
    the problem came after gideros 2023.2 with google play services 21.5.0, but only in the APK, in the player a complete project runs fine with banners, interstitials and rewards...

    please let me know if you can see the logcat correctly...

    Thanks for the help.

  • yes I can see your logcat, it is a bit aligned to the right but we can see it (I copied it to notepad).
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    edited March 2023
    @rodri, the logcat message seems to point to an app id issue, did you set it in the ads plugin properties page ?

    EDIT: By the way the first arg of setKey() call is no longer used in version 21.5.0, since the app id must be specified in the manifest instead, but I added a second argument to setKey() to set the test id.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • rodrirodri Member
    @MoKaLux @hgy29
    thanks for the support, now it works fine..

    Greetings and success...

    Likes: MoKaLux, hgy29

    +1 -1 (+2 / -0 )Share on Facebook
  • ok I managed to build latest Gideros 2023.8 for android using the Ads plugin ;)
    https://github.com/mokalux/gideros-player-for-android

    And a working sample code with admob banners

    PS: google test banners
    PS2: I don't know if Google Play plugin and Google Ads plugin are still linked together (for building the android player I had to add both plugins but in the demo app only the Ads plugin was needed :* )

    You did a great job hgy29 o:)
    zip
    zip
    GIDEROS_ADMOB.zip
    3K

    Likes: pie

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited August 2023
    some code and ss :)
    function LevelX:init()
    	-- BG
    	application:setBackgroundColor(0xaa557f)
    	-- LISTENERS
    	self:addEventListener("enterBegin", self.onTransitionInBegin, self)
    	self:addEventListener("enterEnd", self.onTransitionInEnd, self)
    	self:addEventListener("exitBegin", self.onTransitionOutBegin, self)
    	self:addEventListener("exitEnd", self.onTransitionOutEnd, self)
    	-- ads
    	self.ADMOB_UNIT_ID = "ca-app-pub-3940256099942544/6300978111" -- google banner test id
    	-- admob (setup for simple banner adverts), note: only visible on phone/tablet
    	if application:getDeviceInfo() == "Android" then
    		print("ADS")
    		require 'ads' --create real object for on device
    		self.ADMOB = Ads.new('admob')
    		self.ADMOB:addEventListener(Event.AD_RECEIVED, function() -- show ad
    			print("AD_RECEIVED")
    			self.ADMOB:showAd('banner')
    			self.ADMOB:setAlignment('center', 'bottom')
    		end)
    		self.ADMOB:addEventListener(Event.AD_FAILED, function(e)
    			print("AD_FAILED")
    		end)
    		self.ADMOB:addEventListener(Event.AD_ACTION_BEGIN, function()
    			print("AD_ACTION_BEGIN")
    		end)
    		self.ADMOB:addEventListener(Event.AD_ACTION_END, function()
    			print("AD_ACTION_END")
    		end)
    		self.ADMOB:addEventListener(Event.AD_DISMISSED, function()
    			print("AD_DISMISSED")
    		end)
     
    		self.ADMOB:loadAd("banner", self.ADMOB_UNIT_ID) -- load ad
    	else
    		print("NO ADS")
    		self.ADMOB = {} -- create fake object for testing in windows player
    		self.ADMOB.loadAd = function() end
    		self.ADMOB.showAd = function() end
    	end
    end
    ads_plugin01.png
    1920 x 1080 - 162K
    ads_plugin02.png
    1920 x 1080 - 146K
    app_admob01.png
    1920 x 1080 - 142K
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
Sign In or Register to comment.