gpt4 book ai didi

java - 未找到 AdView 类

转载 作者:行者123 更新时间:2023-12-01 17:56:42 28 4
gpt4 key购买 nike

我想在我的应用程序中添加 AdMob,但在我的应用程序中找不到 AdView 类

build.gradle

...
dependencies {
api ('com.google.android.gms:play-services-ads:16.0.0'){force = true}
api fileTree(dir: 'libs', include: ['*.jar'])
}

layout.xml

...

<com.google.android.gms.ads.AdView
android:id="@+id/banner_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
app:adSize="FULL_BANNER"
app:adUnitId="ca-app-pub-xxx/xxx"/>

...

日志

03-16 11:32:47.006 E/AndroidRuntime(2784): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdView" on path: DexPathList[[zip file ...

最佳答案

dependencies {
compile 'com.google.android.gms:play-services-ads:8.4.0'
}

另请参阅此处:I can't import or use AdView for android

关于java - 未找到 AdView 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60700433/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com