当我尝试在我的设备上启动我的应用程序时,应用程序崩溃并且出现此错误:
android.view.InflateException: Binary XML file line #9: Error inflating class com.google.ads.AdView
我已经尝试使用 stackoverflow 上提出的解决方案,但它不适用于此错误。
文件build.gradle(包括依赖)
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:16'
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.recipes.app"
minSdkVersion 9
targetSdkVersion 9
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-ads:8.3.0'
}
最佳答案
com.google.ads.AdView
是 Mobile Ads SDK 与 Google Play 服务集成之前使用的包名称。尝试使用当前的 com.google.android.gms.ads.AdView
, 而不是在您的布局中。
关于android - 在应用程序 android 上集成 Admob 时出错(应用程序崩溃),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40076998/