Android Question Admob compile error

hookshy

Well-Known Member
Licensed User
Longtime User
After passing the turorial admob when I compile i got the folowing error ?
I do not know what to do next

Parsing code. 0.05
Compiling code. 0.09
Compiling layouts code. 0.01
Generating R file. 0.92
Compiling generated Java code. Error
B4A line: 141
Activity.AddView(AdView1, Activity.Width-320dip, Activity.Height-50dip, 320dip, 50dip) 'previously the height was 48dip. Now it is 50dip.
javac 1.7.0_21
src\hs\safebox\key1\main.java:332: error: cannot access AdView
mostCurrent._activity.AddView((android.view.View)(mostCurrent._adview1.getObject()),(int)(mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(320))),(int)(mostCurrent._activity.getHeight()-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
 

hookshy

Well-Known Member
Licensed User
Longtime User
admob library version 1.40 is loaded
I have renamed the googleadmobadssdk.jar
I have linked C:\android\platforms\android-17\android.jar in my android jar path
I have added to manifest editor
AddApplicationText(<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>)
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I've actually places mine in the library directory under Anywhere Software.

GoogleAdMobAdsSdk.jar

and the two admob files, jar and xml

Then there's the setting in the SDK, where I've ticked the Admob Library and it indicates version 1.36

Manifest editor :

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" 
    android:xlargeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

'End of default text.

'AdMob
AddApplicationText(
 <activity android:name="com.google.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
)
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
In the SDK have you set the Configure Paths? It's under Tools Configure Paths.
C:\android\platforms\android-17\android.jar
if that is what you mean i already use b4a with a lot of libraries

admob files library are copy to my library folder placed on :
D:\basic4android\library

I tried again with your manifest above ..and same error
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
there is another jar file in addon folder libGoogleAnalyticsV2
I do not now by guess what to do I followed the steps ..something in going wrong
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
i recently found that under sdk manager I had a mised one package
Google add mob sds sdk , after instaling it nothing happens ..same problem

I see that google recomend to use google play services insteand of clasic sdk
how the hell this should be done ?
in the librariy i have GoogleAdMobAdsSdk.jar but should it be nother GoogleAdMobAdsSdk.xml?
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
this i found on some documentation
The five lines of code it takes to add a banner:

  • Import com.google.ads.*
  • Declare an AdView instance
  • Create it, specifying the ad unit ID
  • Add the view to the UI
  • Load it with an ad
if i got this error it looks that the library is not recognised or not properly loaded ?
class file for com.google.ads.AdView not found

 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
problem was solved , thank you erel
My mistakes were:
the file was:
1. not int aditional library folder under c/programfiles/anywere software/basic4android/libraries
2. I renamed by mistake the file googleadmobadssdk.jar no extension was neded as pc tuned the file into googleadmobadssdk.jar.jar and sdk was not found

thanks ,

I have one more question :
When do I see the banner into my app ? it takes time or I have to see it write away ?
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
thanks ...I had quite a headache after trying to add advertizements to my app, hopes this will be the last
I will come back to tell you how much money i made
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
the publisher id is like "pub-899434983945893" or should I add only the numbers ?
there is another code associated to the app ..is this needed to?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…