AdMob - Required XML attr. "adSize" was missing



Hi i'm new at android app. developing. So my errors may seem silly and ridicilous and i'm very sorry about that.


Anyways;


I've been trying to use AdMob for my android app. But I can't. On the graphical layout it says "Required XML attr. "adSize" was missing." I looked other topics but no luck so far. Also my app won't start anymore. It always crashes.


ActivityMain.xml



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:ads="http://ift.tt/1bhZ3VK"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/radial_background"
tools:context=".MainActivity"
xmlns:app="http://ift.tt/GEGVYd">

<ImageButton
android:id="@+id/btnSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dip"
android:src="@drawable/btn_switch_on"
android:background="@null"
android:contentDescription="@null" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_ID"
ads:adSize="BANNER"/>


</LinearLayout>
</RelativeLayout>


MainActivity.java



public class MainActivity extends Activity {
AdView adView;
ImageButton buttonSwitches;
private Camera camera;
private boolean cek;
private boolean ciftcek;
Parameters params;
MediaPlayer medpl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest); //adView


AndroidManifest.xml



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
package="com.example.myappname"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"

android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>

</manifest>


Can you tell me what's wrong with that code?


No comments:

Post a Comment