merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #1 Hi, I signed up for an admob account. Got an ap-id after creating a top banner. I then proceeded to update android sdk, and eclipse plugin. Then downloaded the admob 1.40 library, and downloaded the GoogleAdMobAdsSdk-6.4.1.jar (renamed this to GoogleAdMobAdsSdk.jar) and copied them both to basic4android/Additional libraries... I used NJdude's code (thanks!) Code: Copy Adbox.Initialize2("Ad", "xxxxx", Adbox.SIZE_BANNER) Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) Adbox.LoadAd ToastMessageShow("Width=" & Adbox.Width, True) ToastMessageShow("Height=" & Adbox.Height, True) substituted "xxxx" with my ap-id. It compiles alright, but I get stuck on as it starts up. Code: Copy Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) I get a java.lang.NullPointerException.
Hi, I signed up for an admob account. Got an ap-id after creating a top banner. I then proceeded to update android sdk, and eclipse plugin. Then downloaded the admob 1.40 library, and downloaded the GoogleAdMobAdsSdk-6.4.1.jar (renamed this to GoogleAdMobAdsSdk.jar) and copied them both to basic4android/Additional libraries... I used NJdude's code (thanks!) Code: Copy Adbox.Initialize2("Ad", "xxxxx", Adbox.SIZE_BANNER) Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) Adbox.LoadAd ToastMessageShow("Width=" & Adbox.Width, True) ToastMessageShow("Height=" & Adbox.Height, True) substituted "xxxx" with my ap-id. It compiles alright, but I get stuck on as it starts up. Code: Copy Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) I get a java.lang.NullPointerException.
NJDude Expert Licensed User Longtime User Aug 19, 2013 #2 Does your ID looks like: Code: Copy ca-app-pub-xxxxxxxxxxxxxx/xxxxxxxx I've tried myself and it works. Upvote 0
Does your ID looks like: Code: Copy ca-app-pub-xxxxxxxxxxxxxx/xxxxxxxx I've tried myself and it works.
merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #3 oh, something else might be wrong somewhere? Do I have to change the manifest? Upvote 0
NJDude Expert Licensed User Longtime User Aug 19, 2013 #4 Do you have these lines in the Manifest? Code: Copy AddApplicationText(<!-- *** For AdMob: manually added *** -->) AddApplicationText(<activity android:name="com.google.ads.AdActivity") AddApplicationText(android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|smallestScreenSize|screenSize"/>) However, not having these lines should display a different error message. Upvote 0
Do you have these lines in the Manifest? Code: Copy AddApplicationText(<!-- *** For AdMob: manually added *** -->) AddApplicationText(<activity android:name="com.google.ads.AdActivity") AddApplicationText(android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|smallestScreenSize|screenSize"/>) However, not having these lines should display a different error message.
merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #5 Ok, just added that to the manifest, but it didn't help. Just noticed under my global area troubleshooting section... Adbox (adview) Layout not available. Do I have to create another layout in the designer? (for the add) Upvote 0
Ok, just added that to the manifest, but it didn't help. Just noticed under my global area troubleshooting section... Adbox (adview) Layout not available. Do I have to create another layout in the designer? (for the add)
NJDude Expert Licensed User Longtime User Aug 19, 2013 #6 Can you upload your project? if you used my code sample, it is ready to go, but if you have made some modifications then I don't know what the problem might be without seeing it. Upvote 0
Can you upload your project? if you used my code sample, it is ready to go, but if you have made some modifications then I don't know what the problem might be without seeing it.
merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #7 ok, here it is. Attachments result.apk result.apk 271.5 KB · Views: 239 Upvote 0
NJDude Expert Licensed User Longtime User Aug 19, 2013 #8 You have to upload your source code not the APK. In the IDE, click on File -> Export as ZIP Upvote 0
NJDude Expert Licensed User Longtime User Aug 19, 2013 #9 You have to replace line #119 From: Code: Copy Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) To: Code: Copy Activity.AddView(AdBox, 0dip, 100%y - 50dip, 100%x, 50dip) Upvote 0
You have to replace line #119 From: Code: Copy Activity.AddView(Adbox, 0dip, Activity.Height - 50dip, Adbox.Width, Adbox.Height) To: Code: Copy Activity.AddView(AdBox, 0dip, 100%y - 50dip, 100%x, 50dip)
merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #10 Cool it works! I've got to move my text up from the bottom abit. Thanks, for your help. Upvote 0
NJDude Expert Licensed User Longtime User Aug 19, 2013 #11 Ok, now delete your attachment, you have your app ID there, don't make it public. Upvote 0
merlin2049er Well-Known Member Licensed User Longtime User Aug 19, 2013 #12 Yes, I just did. Thanks. Upvote 0