title: Caused by: java.lang.ClassCastException: com.google.android.gms.ads.AdView cannot be cast to com.google.android.gms.ads.NativeExpressAdView
body: <p>I'm getting this error while adding native ads (AdMob)</p>
  
  <blockquote>
    <p>Caused by: java.lang.ClassCastException: com.google.android.gms.ads.AdView cannot be cast to com.google.android.gms.ads.NativeExpressAdView </p>
    
    <p>Help me out..
    My Code is...</p>
  </blockquote>
  
  <pre><code>   `
  
  public class Raining extends AppCompatActivity implements View.OnClickListener {
  
      private InterstitialAd mInterstitialAd;
      NativeExpressAdView adView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_natural);
  
          adView = (NativeExpressAdView) findViewById(R.id.adView);
          adView.loadAd(new AdRequest.Builder().build());
  
          //Top ads
          MobileAds.initialize(getApplicationContext(), "ca-app-pub-8458533793773924/5313130080");
  
          AdView mAdView1 = (AdView) findViewById(R.id.adView1);
          AdRequest adRequest1 = new AdRequest.Builder().build();
          mAdView1.loadAd(adRequest1);
  }}
  
  ********
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:id="@+id/RelativeLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/aa"
      android:gravity="center_vertical"
      android:orientation="vertical"&gt;
  
      &lt;com.google.android.gms.ads.AdView
          android:id="@+id/adView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          ads:adSize="BANNER"
          ads:adUnitId="@string/banner_ad_unit_id_Top"&gt;
  
      &lt;/com.google.android.gms.ads.AdView&gt;
  
      &lt;ImageView
          android:id="@+id/imageView_priview"
          android:layout_width="match_parent"
          android:layout_height="200dp"
          android:layout_below="@+id/adView1"
          android:paddingTop="5dp"
          android:src="@drawable/rain" /&gt;
  
  
      &lt;LinearLayout
          android:id="@+id/linearlayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentEnd="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentStart="true"
          android:layout_below="@+id/imageView_priview"
          android:padding="1dp"&gt;
  
          &lt;Button
              android:id="@+id/btn_main_activty_preview_id"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:text="Preview"
              android:textAppearance="@style/TextAppearance.AppCompat" /&gt;
  
          &lt;Button
              android:id="@+id/btn_main_activty_cancel_id"
  
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:elevation="7dp"
              android:text="Cancel"
              android:textAppearance="@style/TextAppearance.AppCompat" /&gt;
      &lt;/LinearLayout&gt;
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:layout_alignParentBottom="true"
              android:layout_alignParentRight="true"
              android:layout_alignParentEnd="true"&gt;
  
              &lt;com.google.android.gms.ads.NativeExpressAdView
                  android:id="@+id/adView"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_alignParentBottom="true"
                  android:layout_centerHorizontal="true"
                  ads:adSize="280x150"
                  ads:adUnitId="@string/ad_unit_id"&gt;
  
              &lt;/com.google.android.gms.ads.NativeExpressAdView&gt;
          &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;'
  </code></pre>