'Cannot find symbol AdView variable in Class ID Android Studio
When I try to compile my project I received the following error:
C:\..\MainActivity.java:47: error: cannot find symbol
adView = findViewById(R.id.home_banner);
^
symbol: variable home_banner
location: class id
Part of the code in MainActivity.java is:
public AdView adView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//new code for adds
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(@NonNull InitializationStatus initializationStatus) {
}
});
adView = findViewById(R.id.home_banner);
AdRequest adRequest=new AdRequest.Builder().build();
adView.loadAd(adRequest);
...
Any ideas, please.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|