Android Studio does not matter AdRequest or AdView

1

The part that gets written android both of them turn red and it does not matter

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.seamusdawkins.R;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;




public class FirstFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        View view = inflater.inflate(R.layout.fragment_home, container, false);

        AdView mAdView = (AdView) view.findViewById(R.id.ad);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

        return view;
    }


}

I've tried importing by another way by pressing alt + enter in Adview but the import option does not appear

    
asked by anonymous 30.03.2017 / 15:55

1 answer

2

I think you're in serious trouble with AdView . To not be appearing option to import, there is only one reason: You did not compile the lib in Gradle . Here's how:

dependencies {
     compile 'com.google.firebase:firebase-ads:9.6.1'
}

In this option option above, you will be importing the version 9.6.1 , so it is advisable to enter the Release Notes and check which version is most up to date.

Here in this question about Error using AdRequest has a more complete answer of how you can use the < a href="https://www.google.com/admob/"> AdMob .

    
30.03.2017 / 16:04