Q1我不能找到解決辦法之前設置.. logCat
窗口顯示IllegalStateException - "the ad size and ad unit id must be set before load is called " error! "
我用資源,汽車和ad:Size = "BANNER"
的廣告尺寸和廣告單元ID必須負載被稱爲
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.androhttps://stackoverflow.com/posts/29409592/editid.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="0dp"
android:label="@string/app_name"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp" tools:context=".MainActivity">
<com.example.jatinarora.threestickhockey.mView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<com.google.android.gms.ads.AdView
android:id="@+id/abcde"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id2">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
這是我的MainActivity類別的onCreate功能
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
AdView mAdView;
mAdView = (AdView) findViewById(R.id.abcde);
AdRequest adRequest = new AdRequest.Builder()
.build();
mAdView.loadAd(adRequest);
}
這將是很大的幫助,如果任何人能回答
不使用相對佈局的adview而是使用線性佈局 – WISHY 2015-04-02 10:32:36