AdRequest.Builder cannot be resolved to a type
admob, android
Solution
Your code is mix for Admob SDK (Google Play) and Android (6.4.1 and earlier SDKs)
Use
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
AdRequest adRequest = new AdRequest.Builder().build();
and
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="bla bla"
ads:adSize="BANNER"/>
if you use Admob SDK (Google Play)
Or use
import com.google.ads.AdRequest;
import com.google.ads.AdView;
AdRequest adRequest = new AdRequest();
and
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="bla bla"
ads:adSize="BANNER"/>
if you use earlies SDK
For Admob SDK (Google Play) not forget to change namespase
xmlns:ads="http://schemas.android.com/apk/res-auto"
Problem
I'm incorporating AdMob into my app. I've followed the steps in the developers page. However AdRequest.Builder() is being underlined with red and it says: AdRequest cannot be resolved to a type and AdRequest.Builder cannot be resolved to a type. What could be the problem? ``` import com.google.ads.AdRequest; import com.google.ads.AdView; public class FireRoomActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fire_room); // Look up the AdView as a resource and load a request. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } ``` In xml I've shown admob as such: ``` <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="bla bla" ads:adSize="BANNER"/> ```