Reputation: 3587
I have a 2.3.3 android app that I am developing that I would like to add Admob ads onto. The admob ads version is 6.0.1. I follow the directions on googles site to add it and it does not seem to work properly for 2.3.3, and assumed working correctly for 4.0.3. I am developing against for the goal of releasing a 2.3.3 version to support Blackberry playbook and most android devices out there.
When I add everything to the android manifest, with the added being:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk android:minSdkVersion="10" />
With the build path external jar pointing to the android adk path to google admob then the jar in there and then adding this to the XML file:
Up top:
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
And down in the XML layout:
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="I put my id here"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
ads:loadAdOnCreate="true"/>
It comes up with the error on the graphical layout on the 2.3.3 gui designer stating:
"The following classes could not be instantiated: - com.google.ads.AdView (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details."
When I open the class it says it cant see the source.
If I change the GUI designer to be 4.0.3 (as you need to target this apparently to compile) then the admob shows up in a black box and seems ok. I need it working for 2.3.3 though and I seem to crash instantly now when I load this app in the 2.3.3 emulator.
Any help? I read that this should be able to be used in 2.3.3 so I don't understand why. I had a libs folder but I took it out and just externally references the JAR.
Thanks.
Upvotes: 3
Views: 6041
Reputation: 3587
Figured it out.
It was all correct, but it is a bug on why it does not show in the WYSIWYG editor.
When run on the emulator or a device, the ads show.
Upvotes: 2