'Ads do not appear in some devices

When I test the test ads appear on one phone while another phone does not appear even though they are both the same version of the system and even when I tried it on a higher version it did not work (although it is a test ad nothing more)

Java code

Public class MainActivity extends AppCompatActivity {

private AdView mAdView;

@override
protected void onCreate(Bundle 
savedInstanceState) {

 super.onCreate(savedInstanceState);
 setContentView
(R.layout.activity_main);

MobileAds.initialize(this, new. OnInitializeationCompleteListener(){

 @Override
 public void 
 onInitializeationCompleteListener
 (Initial izationState initializationState){
}
});

mAdView = findViewById(R.id.adView);
AdRequest adRequest = new. 
AdRequest.Builder().build();
mAdView.loadAd(adRequest);

 }
}

xml

<LinearLayout
xmlns:android="https://schemas.android.com/apk/res/android"
xmlns:tools="https://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<com.google.android.gms.ads.AdView
  xmlns:ads="https://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
ads:adsSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>

</LinearLayout>

in gradel

dependencies {
implementation'com.google.android.gms:play-services-ads:20.6.0'
}

mainfest

uses-permission android:name="android.permission.INTERNET" />


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source