Android Question class file for com.google.android.gms.ads.AdView not found

RichyK68

Active Member
Licensed User
Longtime User
Hi, I'm trying to compile an app that uses the AdMob v2.00 library and I'm getting the error:

...\admobsupport.java:29: error: cannot access AdView
_a.AddView((android.view.View)(_adview1.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (320)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
^
class file for com.google.android.gms.ads.AdView not found


I believe it's because I have v25 of Google Play Services, and I should be using v20?

I have this in my Main module:

B4X:
#AdditionalRes: c:\Users\Richard\AppData\Local\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

If I do need to use v20, do you know where I can get it from? If it's not a version issue, does anybody know what is causing the error?

Thank you,

Richy
 

RichyK68

Active Member
Licensed User
Longtime User
I've found a version which now actually compiles but I'm now getting a message at run-time telling me that the manifest does not have the right value. It tells me it expects 6171000 but has found 7895000 and that I must include

<meta-data android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version"/>

in my manifest, but I already have that.

Any ideas?

Thanks,

Richy
 
Upvote 0

RichyK68

Active Member
Licensed User
Longtime User
I've sussed that one out, it was in the google-play-services_lib\res\values.xml file. I appear to have got a number of different versions here. What is the recommended approach to keep a particular version with a particular project? So that even if the SDK changes, it won't affect a project?

Richy
 
Upvote 0

mokrokuce

Member
Licensed User
Longtime User
Same error during compiling: "...class file for com.google.android.gms.ads.AdView not found"
I started with the first post here: https://www.b4x.com/android/forum/threads/admob-tutorial-add-ads-to-your-application.7300/
I installed the latest SDK . Then I realized that i have GooglePlayServices (in future GPS) rev 30, and that the file google-play-services.jar is nowhere to be found.
Then I got the file from this post: https://www.b4x.com/android/forum/threads/fusedlocationprovider.50614/page-7#post-424742 extracted the entire "google-play-services" folder to my <sdk>\extras\google.
Then I copied the file "google-play-services.jar" from C:\Android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\libs to my additional libraries folder "C:\Android\android-sdk\additional-libraries".
I put in my manifest editor:
B4X:
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

...and in my project:
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #AdditionalRes: C:\Android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res, com.google.android.gms
    #AdditionalJar: android-support-v4
#End Region
Configured paths:
upload_2016-6-14_16-10-18.png

Loaded AdMob 2.0 lib:
upload_2016-6-14_16-8-38.png


...but still on compiling get an error:
upload_2016-6-14_16-11-20.png


I am loosing my mind here, stuck here for two days. Read this post - still clueless. Read this tut (all 32 pages) - again: clueless.
Any help?
 
Upvote 0

mokrokuce

Member
Licensed User
Longtime User
Erel, thanks for the prompt response (I really wonder how you keep up with all the questions).
Is B4A v6 released yet?
 
Upvote 0
Top