Android 添加间隙广告后应用程序崩溃
横幅广告运行良好,我尝试添加间隙广告,但现在我的应用程序崩溃 这是Logcat:Android 添加间隙广告后应用程序崩溃,android,firebase,admob,interstitial,Android,Firebase,Admob,Interstitial,横幅广告运行良好,我尝试添加间隙广告,但现在我的应用程序崩溃 这是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.angelaso
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.
My 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'
还有我的身材,格雷德尔
// 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内容是什么意思?我如何解决它?
我错过什么了吗?
以下是我为间隙ad添加的代码:
在my MainActivity.java中:
InterstitialAd mInterstitialAd;
private InterstitialAd interstitial;
在my 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>
ca-app-pub-3940256099942544/1033173712
这是示例id,不是我自己的。尝试使用
classpath'com.google.gms:google services:3.0.0'
在LogCat中是否有适当的异常堆栈跟踪?你贴的日志不是很有用