I have seen many similar topics at this forum, but none of them solved my problem. In my code I have something like this:
import com.google.android.gms.R;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
...
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);
And it shows me 2 errors(I marked the red marks as bold text):
-In first line: "AdView adView = (AdView)this.findViewById(R.id.adView);" - adView cannot be resolved or is not a field
-And in last line: "adView.loadAd(adRequest);" - The type android.view.ViewGroup cannot be resolved. It is indirectly referenced from required .class files
I have no idea what causes it. I also had a problem with lack of "layout" folder before, but I generated it with eclipse new>other>android XML layout file. Should I also somehow link it using manifest?
P.S. It's libGDX project
EDIT: Here is my layout/activity_main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
your problem is with this line
remove this and import your package .R file