0
こんにちは私は1つのアプリを作成し、firebaseの広告を統合していますが、広告は表示されません私はこのアプリケーションを実装するデモアプリケーションを作成します。 。firebase banner adsが私のアプリで動作していません
私のアプリのGradleのファイル
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.wallpaper.hd"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/mint-5.0.0.jar')
compile 'com.facebook.fresco:webpsupport:0.10.0'
compile 'com.facebook.fresco:webpsupport:0.10.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'me.neavo:volley:2014.12.09'
compile 'com.facebook.fresco:fresco:0.10.0'
compile 'com.facebook.fresco:animated-base-support:0.10.0'
compile 'com.facebook.fresco:animated-gif:0.10.0'
compile 'com.facebook.fresco:animated-webp:0.10.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'jp.wasabeef:recyclerview-animators:2.2.3'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.eftimoff:android-viewpager-transformers:[email protected]'
compile 'com.jpardogo.googleprogressbar:library:1.2.0'
compile 'com.mani:ThinDownloadManager:1.2.5'
compile 'com.theartofdev.edmodo:android-image-cropper:2.2.+'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.firebase:firebase-ads:9.0.0'
compile 'com.github.hotchemi:android-rate:1.0.1'
/* compile 'com.google.android.gms:play-services-ads:9.0.0'*/
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
もまたmainfest
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
01にメタデータを追加JSONファイル
を追加
私の活動のJavaファイル
public class DesclaimerActivity extends AppCompatActivity {
AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_desclaimer);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
initAllControls();
}
private void initAllControls() {
WebView webView;
MobileAds.initialize(getApplicationContext(), "ca-app-pub-4983020786912744~6430335512");
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.build();
//.addTestDevice("FD515D9CC8B38F22AA850B22CA5D2F06")//.addTestDevice("764C199831DAD735E767FA0189CDDFB8")
mAdView.loadAd(adRequest);
/* webView=(WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
String customHtml = "<html><body><font color='#272727'>"+getString(R.string.desclaimer)+"</font></body></html>";
webView.loadData(customHtml, "text/html", "UTF-8");*/
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
onBackPressed();
return true;
}
@Override
public void onPause() {
if (mAdView != null) {
mAdView.pause();
}
super.onPause();
}
/** Called when returning to the activity */
@Override
public void onResume() {
super.onResume();
if (mAdView != null) {
mAdView.resume();
}
}
/** Called before the activity is destroyed */
@Override
public void onDestroy() {
if (mAdView != null) {
mAdView.destroy();
}
super.onDestroy();
}
}
活動にxmlファイルは、あなたのマニフェストにadactivityのconfigとテーマを追加しましたバナーID
<string name="banner_ad_unit_id">ca-app-pub-4983020786912744/9383801917</string>