更新时间:2022-10-23 16:12:24
确定我已经解决EXPORTING我的Eclipse项目导入机器人工作室 那么我就跟着GOOGLE指南[的https://developers.google.com/mobile-ads-sdk/docs/admob/android/interstitial][1]
有一点非常明确
I am trying to add AdMob ads in my application.
In the manifest I have:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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"
android:theme="@android:style/Theme.Translucent" />
In the xml activity's layout I use:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/id">
</com.google.android.gms.ads.AdView>
My java code in the main activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAdView = (AdView) findViewById(R.id.adView);
adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
Unfortunately this doesn't work and I receive this error
error: No resource identifier found for attribute 'adSize' in package
OK I'VE SOLVED EXPORTING MY ECLIPSE PROJECT INTO ANDROID STUDIO THEN I'VE FOLLOWED THE GOOGLE GUIDE [https://developers.google.com/mobile-ads-sdk/docs/admob/android/interstitial][1]
IT'S VERY CLEAR