title: Load ads error mAdView.loadAd(adRequest);
body: <p>I tried to put the ads to my app follow the Google docs but always got the problem.</p>
  
  <p>My mainactivity code:</p>
  
  <pre><code>import com.google.android.gms.ads.MobileAds;
  import com.google.android.gms.ads.AdRequest;
  import com.google.android.gms.ads.AdView;
  
  public class DongVatHoc extends AppCompatActivity {
  private AdView mAdView;
  
  @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.dong_vat_hoc_activity);
  
          // Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
          MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
  
          mAdView = findViewById(R.id.adView);
          AdRequest adRequest = new AdRequest.Builder().build();
          mAdView.loadAd(adRequest);
  }
  </code></pre>
  
  <p>My build.gradle(project):</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
  
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.2.1'
  
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
          maven {
              url "https://maven.google.com"
          }
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>My build.gradle(app)</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "com.nguyen.tubi.bich.testapp"
          minSdkVersion 16
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      //noinspection GradleCompatible
      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.google.android.gms:play-services-ads:17.1.1'
  }
  </code></pre>
  
  <p>And my dong_vat_hoc_activity.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      android:orientation="vertical"
      android:background="@drawable/dong_vat_bg"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;GridView
          android:id="@+id/gridviewHinh"
          android:layout_width="match_parent"
          android:layout_height="477dp"
          android:paddingRight="4dp"
          android:gravity="center"
          android:numColumns="3"&gt;
  
      &lt;/GridView&gt;
  
      &lt;com.google.android.gms.ads.AdView
          xmlns:ads="http://schemas.android.com/apk/res-auto"
          android:id="@+id/adView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_alignParentBottom="true"
          ads:adSize="BANNER"
          ads:adUnitId="ca-app-pub-3940256099942544/6300978111"&gt;
      &lt;/com.google.android.gms.ads.AdView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Everything above that I followed the Google docs but it got the problem:[Google Docs]</p>
  
  <pre><code>'void com.google.android.gms.ads.AdView.loadAd(com.google.android.gms.ads.AdRequest)' on a null object reference
  </code></pre>
  
  <p>That problem of the line: mAdView.loadAd(adRequest);</p>
  
  <p>So please help me how to solve that.</p>