
^ there is the image so you know I’m using sdk 3.2. There is more to this code, but basically this is everything for my java code inside my main one, and it doesn’t load my ads when I go to load them. There are no errors and nothing in my Main.XML for the ad Basically the ad is not showing at all
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
public class LearningLettersActivity extends Activity
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create the adView
adView = new AdView(this, AdSize.BANNER, "aXXXXXXXXXXXXXXXX); //<---My Publisher Id there"
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout" \
LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
Here is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.better.work.learning.letters.and.more"
android:versionCode="3"
android:versionName="1.00">
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:name=".LearningLettersActivity"
android:label="@string/app_name"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk android:minSdkVersion="4"/>
</manifest>
Basically nothing is pooping up for my ads at all when I go to test it on my phone, I tried using the code below and still nothing.
AdRequest adrequest = new AdRequest();
adrequest.setTesting (true);
adView.loadAd(adrequest);
I’ve also tried:
AdRequest adrequest = new AdRequest();
adrequest.setTesting (true);
adrequest.setTestingDevices("HT0CWHL11423") //<--- the name of my phone that appears when I go to load the emulator tab
adView.loadAd(adrequest);
Result:
01-18 03:50:19.874: E/Ads(16938): Could not find com.google.ads.AdActivity, please make sure it is registered in AndroidManifest.xml.
01-18 03:50:19.874: E/Ads(16938): You must have AdActivity declared in AndroidManifest.xml with configChanges.
Look in the logcat for anything with the Tag
Ads. Specifically, look for something like:It is possible that you are not getting ads back because AdMob cannot fill an ad.
There are a couple of things to note here.
AdRequest.setTesting(true), which only used to set test mode for emulators, is deprecated in favor ofAdRequest.addTestDevice(AdRequest.TEST_EMULATOR)for setting test mode on an emulator. For setting a test device, the device id you are supposed to enter is a hashed device id, which you can find in the logcat as well if you are debugging on your device.Finally, the picture that you’re using shows you have the SDK included for a ButtonMasher app, but the code you provided looks like it’s for a Letter Learning app. Make sure you are indeed using 4.3.1 in this app.