gpt4 book ai didi

c# - Admob 测试 xamarin android

转载 作者:太空狗 更新时间:2023-10-29 14:46:52 25 4
gpt4 key购买 nike

我正在尝试为我的应用程序实现和测试 admob 广告,但在广告加载后没有任何内容出现。

我使用 xml 实现它:

 <com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
customFont:adSize="MEDIUM_RECTANGLE"
customFont:adUnitId="@string/banner_ad_unit_id" />

当我的应用程序正在加载某些内容时,我会加载它:

    mAdView = (AdView)FindViewById(Resource.Id.adView);
Bundle extras = new Bundle();
extras.PutBoolean("_noRefresh", true);
AdRequest adRequest = new AdRequest.Builder().AddTestDevice(AdRequest.DeviceIdEmulator).AddTestDevice("my-device-id").AddNetworkExtrasBundle(Java.Lang.Class.FromType(typeof(AdMobAdapter)), extras).Build();
mAdView.LoadAd(adRequest);

我已经使用了我的 ID 和测试 ID。我还使用了不同类型的横幅广告,但没有任何改变广告无法加载。

此外,当添加尝试加载时出现错误:

08-25 18:11:16.738 I/Ads     (12021): Starting ad request.
08-25 18:11:16.738 D/AppStreamingHelper(12021): Creating delegate
08-25 18:11:16.748 W/DynamiteLoaderImpl(12021): Failed to load module version: module com.google.android.gms.piccard.dynamite not found
08-25 18:11:16.748 D/GmsModuleFndr(12021): Staging file APK's and updating chimera config...
08-25 18:11:16.798 D/GmsModuleFndr(12021): Staging file APKs completed
08-25 18:11:16.798 W/DynamiteLoaderImpl(12021): Failed to load module version after staging: module com.google.android.gms.piccard.dynamite not found
08-25 18:11:16.798 W/DynamiteModule(12021): Local module descriptor class for com.google.android.gms.piccard.dynamite not found.
08-25 18:11:16.798 I/DynamiteModule(12021): Considering local module com.google.android.gms.piccard.dynamite:0 and remote module com.google.android.gms.piccard.dynamite:0
08-25 18:11:16.798 E/AppStreamingHelper(12021): No acceptable module found. Local version is 0 and remote version is 0.
08-25 18:11:16.888 I/Choreographer(12021): Skipped 32 frames! The application may be doing too much work on its main thread.
08-25 18:11:17.598 I/dalvikvm(12021): Total arena pages for JIT: 11
08-25 18:11:17.598 I/dalvikvm(12021): Total arena pages for JIT: 12
08-25 18:11:17.598 I/dalvikvm(12021): Total arena pages for JIT: 13
08-25 18:11:17.598 I/dalvikvm(12021): Total arena pages for JIT: 14
Thread finished: <Thread Pool> #4
08-25 18:11:21.888 D/Mono (12021): [0x6960bb60] worker finishing
Le thread 'Unknown' (0x4) s'est arrêté avec le code 0 (0x0).
08-25 18:11:27.738 W/Ads (12021): There was a problem getting an ad response. ErrorCode: 0
08-25 18:11:27.738 W/Ads (12021): Failed to load ad: 0

我只想工作一次来改变广告的“显示”。

提前致谢。

编辑:

如果有用,我会添加我的 list 文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.askmethat.cheerup" android:installLocation="internalOnly" android:versionName="1.0Beta" android:versionCode="4">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application android:label="@string/app_name" android:name="@string/app_name" android:icon="@drawable/Icon" android:theme="@style/CheerUpTheme" android:hardwareAccelerated="true">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
<activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
<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" android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>

最佳答案

您是否添加了权限?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />



[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.AccessNetworkState)]

还要确保安装了最新的播放服务 https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/29.0.0.2

有关更多信息,请点击此教程链接 https://blog.tommyparnell.com/admob-with-xamarin-part-1-banner-ads/

关于c# - Admob 测试 xamarin android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39150271/

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