Android Studio 2.2.3 on Fedora 24

Wed, 01/25/2017 - 10:05pm -- mjpierce
Tag: 

sudo ./adb kill-server
sudo ./adb start-server

 

public static class AdFragment300x50 extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_ad_300x50_home, container, false);
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);

        PublisherAdView mAdView4 = (PublisherAdView) getView().findViewById(R.id.adView_300x50);
        //we're overriding settings defined in the fragment
        AdSize mml = new AdSize(300, 50);
        mAdView4.setAdSizes(mml);
        mAdView4.setCorrelator(correlator);

        PublisherAdRequest adRequest4 = new PublisherAdRequest.Builder()
                .addCustomTargeting("pos", "ns_atf_01")
                .addCustomTargeting("appmode", "test")
                .build();
        mAdView4.loadAd(adRequest4);
    }
}

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content" android:layout_height="wrap_content" >

    <com.google.android.gms.ads.doubleclick.PublisherAdView
        android:id="@+id/adView_300x50"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/home_ad_unit_id"
        >
    </com.google.android.gms.ads.doubleclick.PublisherAdView>

</RelativeLayout>
AttachmentSize
Binary Data app-debug.apk4.03 MB