Hi,
I'm implementing AdMob - at least trying... I've downloaded Google Play Services (the AdMob SDK seems to no longer have a direct download).
I've placed the line in the B4A project:
#AdditionalRes: C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
and configured the rest as in the example.
I'm getting the following error: class file for com.google.ads.AdView not found...
Any ideas?...
I am having the same problem. I have:
1. Edited the b4a ini file (MaxRamForDex=1024)
2. Added the following line to my project file (under "#Region Project Attributes")
#AdditionalRes: C:\Java\x86\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
which does point to my res files
2. Added the following to the manifest
'AdMob
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
)
'End of AdMob
3. Updated and copied the "google-play-services.jar" file to libraries
4. Copied the "GoogleAdMobAdsSdk-6.4.1.jar" file to libraries
5. Downloaded and installed (ie copied into libraries) v1.4 of AdMob library
6. Selected "AdMob" in libraries tab in b4a
7. Added the following code to the project:
Sub Globals
Dim AdView1 As AdView
End Sub
Sub Activity_Create(FirstTime As Boolean)
AdView1.Initialize("Ad", "<my personal id>")
Activity.AddView(AdView1, 0dip, 50dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad
AdView1.LoadAd
End Sub
And I am getting this error:
Parsing code. 0.02
Compiling code. 0.03
Compiling layouts code. 0.00
Generating R file. 0.88
Compiling generated Java code. Error
B4A line: 138
Activity.AddView(AdView1, 0dip, 50dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad
javac 1.7.0_07
src\xxx\xxx\xxx\main.java:440: error: cannot access AdView
mostCurrent._activity.AddView((android.view.View)(mostCurrent._adview1.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (320)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
^
class file for com.google.ads.AdView not found
1 error
Now, the thing to watch out on is that I am running b4a v3.2
Any ideas? What have I missed?
I noticed in some of the tutes I read it referred to an AdMob library version of 2.x while I could only find 1.4.
I just checked and found this post refers to v2 but the download zip is 1.4.
https://www.b4x.com/android/forum/threads/admob-library.7301/
Also, the example code used something like "AdView1.Pause" which is not available in v1.4. Is there a different library somewhere?
OK I think I found out where I went wrong. I must of used an AdMob.zip library file I downloaded before instead of the latest. It now all appears to be working for me.