gpt4 book ai didi

android - 播放服务和 AdMob : Expected 4132500 but found 4242000

转载 作者:太空宇宙 更新时间:2023-11-03 10:21:00 25 4
gpt4 key购买 nike

我正在尝试在我的应用中添加广告。已通过 SDK 管理器安装最新的 Play 服务 (15),将其导入 Eclipse(确保将“复制文件”选项标记为推荐),并将其作为库添加到我的应用程序项目中。

应用程序崩溃,我收到以下 logcat 错误:

The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 4242000. You must have the following declaration within the element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

但是,我的 AndroidManifest.xml 文件中确实有这样的声明:

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

我还有:

<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

在我的 activity_main.xml 中我有:

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-6017910481591555/7224650198"
ads:adSize="BANNER" />

在我的 MainActivity 的 onCreate() 中是:

AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("my device code") //yes, I have the correct code here
.build();
adView.loadAd(adRequest);

并导入以下内容:

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

我发现其他答案的错误非常相似,只是在那些情况下找到的值为 0,而不是这里的 4242000。

如果我将“@integer/google_play_services_version”更改为预期值“4132500”,则会收到以下错误:

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

我在 AdMob 找到了对 com.google.android.gms.ads.AdView 的引用和 com.google.ads.AdView 在 Android lessons ,我可能会把它们混在一起(?)需要做什么才能不收到这些错误消息?

最佳答案

这是因为google play服务库的版本不同。只需在您的 google_play_services_lib 中打开 res/values/version.xml 并将 4242000 更改为 4132500。它将起作用。

关于android - 播放服务和 AdMob : Expected 4132500 but found 4242000,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21973310/

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