横幅广告工作正常,而且我尝试添加插页式广告但现在我的应用崩溃了。
这是Logcat:
03-02 16:37:32.523 1867-1867/? I/art: Late-enabling -Xcheck:jni
03-02 16:37:32.614 1867-1867/com.aaron.waller.angelasoundboard W/System: ClassLoader referenced unknown path: /data/app/com.aaron.waller.angelasoundboard-2/lib/arm64
03-02 16:37:32.631 1867-1867/com.aaron.waller.angelasoundboard I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
03-02 16:37:32.878 1867-1867/com.aaron.waller.angelasoundboard E/Bundle: unparcel readArrayMapInternal exception
03-02 16:37:32.880 1867-1867/com.aaron.waller.angelasoundboard W/Ads: Could not get info for ad overlay.
我的build.gradle应用:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.exampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.aurelhubert:ahbottomnavigation:1.1.8'
compile 'com.google.firebase:firebase-ads:10.2.0'
}
apply plugin: 'com.google.gms.google-services'
我的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Logcat内容的含义是什么?如何解决? 我错过了什么? 以下是我为插页式广告添加的代码:
在我的MainActivity.java中:
InterstitialAd mInterstitialAd;
private InterstitialAd interstitial;
在我的MainActivity.java onCreate:
// Prepare the Interstitial Ad
interstitial = new InterstitialAd(MainActivity.this);
// Insert the Ad Unit ID
interstitial.setAdUnitId(getString(R.string.admob_interstitial_id));
interstitial.loadAd(adRequest);
// Prepare an Interstitial Ad Listener
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
// Call displayInterstitial() function
displayInterstitial();
}
});
这是我的string.xml:
<string name="admob_interstitial_id">ca-app-pub-3940256099942544/1033173712</string>
这是示例ID,而不是我自己的。