Admob New Adrequest() Unrecognized By Eclipse
I am trying to add ad to my simply game. I' ve followed instructions from here: [url]https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx[/url] . My AndroidLauncher looks like thi
Solution 1:
You are mixing up the old/deprecated admob api with the new admob api(via google play services). You have:
import com.google.ads.AdSize;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
You have to stick to one api.
If it's the old, thus libs/GoogleAdMobAdsSdk-6.4.1.jar, you'd have to import the classes from the packages:
import com.google.ads.AdSize;
import com.google.ads.AdRequest;
import com.google.ads.AdView;
and set up the adview:
// Create and setup the AdMob view
AdViewadView=newAdView(this, AdSize.BANNER, "xxxxx"); // Put in your secret key here
adView.loadAd(newAdRequest());
If it's the new admob via the google play services library, then you should have:
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
AdViewadView=newAdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
AdRequestadRequest=newAdRequest.Builder().build();
adView.loadAd(adRequest);
Post a Comment for "Admob New Adrequest() Unrecognized By Eclipse"