0
は表示されませんが、それだけでここに任意のものを表示せずにスペースを取ることはactivity_main.xmlAdMobのは、私がAdMobの上でサインアップしていると私はアプリイドを得たので、広告はactivity_main.xmlに表示されるように想定
のコードですMainActivityクラスの<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="com.android.homeexercises.MainActivity"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#0000"
>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</ScrollView>
コード:
マニフェストで@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
コード:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.afai_aapps109.android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.android.homeexercises.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
とライブラリでgradle:
compile 'com.google.android.gms:play-services:11.0.0'
google_app_idがありません。 Firebase Analyticsが無効になっています。 disabled.that私は、logcatで任意の提案を見つけたものだ名前google_app_id.Missing google_app_id ._______ Firebase解析して文字列リソースからからGoogleのアプリケーションIDの値がありません、10:_____ GoogleServiceは、初期化するために、ステータスを失敗しましたか? – LCTS
ログを慎重に確認してください。そのログは、広告ではなく、firebase分析に関連しています。ファイルgoogle-services.jsonを適切にリンクすることで、そのfirebaseエラーを修正できます。 –