Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
AdMob plugin - Page 4 — Gideros Forum

AdMob plugin

124

Comments

  • Create main.xml in layout folder with this content:
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="<a href="http://schemas.android.com/apk/res/android&quot" rel="nofollow">http://schemas.android.com/apk/res/android&quot</a>;
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="horizontal"
     android:gravity="bottom"
     android:id="<a href="http://forum.giderosmobile.com/profile/%2Bid%2Flayout_main%26quot" rel="nofollow">@+id/layout_main&quot</a>; >
    </FrameLayout>
    And yes this layout is something that was bundled with AdMob Plugin and is not part of Gideros export, probably, because there is a decision needs to be made, which layout type and hierarchy is best to use when there would be more native elements added. So it will probably change in future
  • That fixed it. Thanks! I must have added that file and then lost it when I redid the export.
  • yubaroyubaro Member
    edited July 2013
    Hello, I have a problem, my application is closed continuously, this is the code that goes into eclipse:

    An error occurred while stopping loading in AdWebView:
    java.lang.NullPointerException
    at android.webkit.WebView.stopLoading(WebView.java:1774)
    at com.google.ads.internal.AdWebView.stopLoading(SourceFile:234)
    at com.google.ads.internal.d.A(SourceFile:1097)
    at com.google.ads.internal.d.b(SourceFile:305)
    at com.google.ads.AdView.destroy(SourceFile:277)
    at com.giderosmobile.android.plugins.AdMob$1.run(AdMob.java:104)
    at android.os.Handler.handleCallback(Handler.java:618)
    at android.os.Handler.dispatchMessage(Handler.java:123)
    at android.os.Looper.loop(SourceFile:351)
    at android.app.ActivityThread.main(ActivityThread.java:3850)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:538)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
    at dalvik.system.NativeStart.main(Native Method)


    Other code when closed


    W/webcore(23462): Can't get the viewWidth after the first layout
    I/System.out(23462): close [socket][/0.0.0.0:44363]
    W/System.err(23462): org.apache.http.NoHttpResponseException: The target server failed to respond
    W/System.err(23462): at android.net.http.AndroidHttpClientConnection.parseResponseHeader(AndroidHttpClientConnection.java:340)
    W/System.err(23462): at android.net.http.Request.readResponse(Request.java:296)
    W/System.err(23462): at android.net.http.Connection.processRequests(Connection.java:314)
    W/System.err(23462): at android.net.http.ConnectionThread.run(ConnectionThread.java:144)

    Thanks!
  • ar2rsawseenar2rsawseen Maintainer
    @yubaro hello unfortunately I won't be able to tell much based on this logs.
    Does it happen all the time? Is it happens right from the start, or you are able to access the app and it happens after some time?
  • yubaroyubaro Member
    edited July 2013
    Thanks for responding. The application works well to some extent, can be one minute or 10 minutes and then shuts down. Not with the same time but it always happens

    It may be important, the application is passed from one level to another automatically when you complete the achievement ...and in some load levels admob
  • yubaroyubaro Member
    Anyone have any idea please?

    Eclipse:

    before the error:
    W/webcore(31076): Can't get the viewWidth after the first layout


    after the error:
    java.lang.NullPointerException
    at android.webkit.WebView.requestFocus(WebView.java:6678)
    at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1110)
    at android.view.ViewGroup.requestFocus(ViewGroup.java:1066)
    at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1110)
    at android.view.ViewGroup.requestFocus(ViewGroup.java:1066)
    at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1110)
    at android.view.ViewGroup.requestFocus(ViewGroup.java:1066)
    at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1110)
    at android.view.ViewGroup.requestFocus(ViewGroup.java:1066)
    at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1110)
    at android.view.ViewGroup.requestFocus(ViewGroup.java:1069)
    at android.view.View.requestFocus(View.java:3721)
    at android.view.View.requestFocus(View.java:3699)
    at android.view.ViewRoot.focusableViewAvailable(ViewRoot.java:1757)
    at android.view.View.setFlags(View.java:4683)
    at android.view.View.setVisibility(View.java:3166)
    at android.app.Activity.makeVisible(Activity.java:3269)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2340)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1022)
    at android.os.Handler.dispatchMessage(Handler.java:130)
    at android.os.Looper.loop(SourceFile:351)
    at android.app.ActivityThread.main(ActivityThread.java:3850)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:538)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
    at dalvik.system.NativeStart.main(Native Method)

    Thanks
  • ar2rsawseenar2rsawseen Maintainer
    @yubaro well the problem is, that it seems that AdmobSDK itself is causing the null pointer exception. But I have no idea why.
    Did you use this plugin: https://github.com/ar2rsawseen/AdMob As in downloaded the latest version? Did you use the latest version of AdmobSDK?
  • yubaroyubaro Member
    @ar2rsawseen thanks for your answer.

    Yes, I use this plugin :https://github.com/ar2rsawseen/AdMob

    and I've tried both the version GoogleAdMobAdsSdk-6.1.0 and the latest GoogleAdMobAdsSdk-6.4.1

    And in both leaves that mistake.
  • KarrizKarriz Member
    edited December 2013
    Hi, I cannot get the "R" file to generate. I've imported the correct domain that's same as specified in Android Manifest of my app.
    I also added the main.xml file as suggested above.

    Now, I've tried to clean the project, but it doesn't help. There has to be something I'm missing.

    Edit: Now I seem to have it right. I had edited the existing Activity in AndroidManifest, while I should've created a new one.
  • make sure you had put xml file in layout folder, compare the manifest file , putted the .so files and plugin at proper place, and added jar file properly. also make sure the by mistake eclipse had not added package name from any other package if all this things are correct sometime closing and re opening eclipse will also work

    :)
  • Also to generate R resources, you need to build the project. Cleaning it usually removes the build, resulting in .R not found.
    And building is not the same as running the app, so building can be done even with errors (like missing .R ) in project ;)
  • KarrizKarriz Member
    edited December 2013
    Okay, it did generate. Am I supposed to see a banner that says "You must have AdActivity declared in AndroidManifest.xml in configChanges"?

    I might have done that incorrectly.

    Edit: Okay, I got an ad to show up after some fiddling. An toothpaste ad!

    Likes: ar2rsawseen

    +1 -1 (+1 / -0 )Share on Facebook
  • ramoseramose Member
    edited February 2014
    I'm using Android Studio. Setting in project with no errors.
    But every time my game opened, it suddenly closed with
    "unfortunately, .... has stopped"

    Using GoogleAdMobAdsSdk-6.1.0.ar or GoogleAdMobAdsSdk-6.4.1.jar is the same error.
  • @ramose

    may be spelling mistake "image.png" and "Image.png" are different in android device

    :)
  • hgvyas123,

    this error happened after I implemented AdMob integration.
    It shows blank dark page, and suddenly quit with that message.
  • some errors actually exists in my android project:

    java: package com.google.ads does not exist
    java: package com.google.ads.AdRequest does not exist
    java: cannot find symbol
    symbol: class AdListener
    java: cannot find symbol
    symbol: class AdView
    location: class com.giderosmobile.android.plugins.AdMob
  • @ramose it means your project does not see the .jar file, did you put it in the libs folder?
  • ramoseramose Member
    edited February 2014
    Updated:
    Now all errors gone. But still having error message every time my game run.
    "unfortnately.... has stopped".
    Can anyone help me?
  • Updated binaries on github, try downloading and replacing libadmob.so files again ;)
  • Hi ar2rsawseen,

    thanks for the updated. I've replaced so files with new ones. But still not working and ended with same error.

    In case you want, you can download and check my android studio project here:
    https://www.mediafire.com/?z4gapc0alaldm1d

    Thanks:)
  • Anyway, in gideros project, require 'admob' doesn't mean there should be admob.lua, right?
  • ar2rsawseen ,

    at last I tried to use admob android project template from github. And replace all assets with mine. And it works!

    Banner appears, buat I can't touch any button on the page. What did I do wrong?
  • Ah, sorry for it to work with newest Gideros version, you needed to take .so binaries from AdMob/tree/master/AdMobPlugin/libs not from the example project.
  • @ar2rsawseen,

    many thanks!!! it works now.
  • Hey @ar2rsawseen, I'm implementing the adMob plugin and have some questions. I set up an account at AdMob and had to install the Google Play SDK and some other stuff in Eclipse.

    My question is that in this page: https://developers.google.com/mobile-ads-sdk/download?hl=en_US , as you can see it says for the Mobile Ads SDK 6.4.1: "Deprecated. On August 1, 2014, Google Play will stop accepting new or updated apps that use the old standalone Google Mobile Ads SDK v6.4.1 or lower. You must upgrade to the Google Play version of the Mobile Ads SDK by then"... and in the tutorial it says that we should include the ".jar" file, which I find in this SDK which will be soon unsupported. I followed the instructions from Google and according to it, you don't import that file, but a library in a folder called "google-play-services_lib".

    In the point I'm at in your tutorial I have some errors that I suppose are taking place because I don't have the .jar file installed.

    So I wanted to know if there's some new way to implement your AdMob plugin using the new Google Play model. It's my first attempt implementing ads so I don't have a clue as to when these changes took place and if it all should work fine using the ".jar" file and there won't be a problem in the future.

    Thanks in advance! Hope my question was clear (:'
  • ar2rsawseenar2rsawseen Maintainer
    @Disciple basically you will have to migrate from the old jar to new Google Play lib by changing the java code.

    Here is the list of changes to do:
    https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration

    Please try it, as I currently don't have much time to spend on it, but if you still won't succeed I'll try to help you :)
  • @ar2rsawseen Thank you! I'll check it :)
  • @ar2rsawseen I tried replacing the code to the new one according to the guide you posted but given my knowledge of Java is basically 0, I wasn't able to get rid of some errors and decided to go with the classic SDK. It all seems to be working fine on Eclipse, or at least no errors are shown.

    But now I have another basic question. When executing the code in lua (from your example):
    Use
     require "admob"
     
    admob.loadAd("a1503a4aec3aca3", "banner")
    admob.setAlignment("left", "bottom")
    It says "module 'admob' not found". How do I make the plug-in available in Gideros?
  • Can I set admob banner position in app? I mean admob:setPosition(x,y) or somthing?
  • yubaroyubaro Member
    @GGGRRR123 Try:

    admob:setAlignment("center", "bottom")
Sign In or Register to comment.