Xamarin Android Admob 测试广告仅在设备上显示一次

Xamarin Android Admob Test Ads only show once on a device

我开发了一个 Xamarin Forms 应用程序,我最近想合并 Admob Ads 并使用了 this 教程。 iOS 版本完美运行,而 Android 版本仅在新的模拟器(格式化)上显示一次测试广告,并且再也不会出现。当我创建一个新的模拟器时,我只会在第一次部署时看到广告,随后重新 运行 广告不再显示该应用程序。我的 Admob 帐户似乎没有任何问题。

我使用的教程很旧,所以我不得不在 Android 清单中添加此片段:

        <application android:label="MyApp">
             <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="my admob app id ~" />
             ....
        </application>

当广告未显示时,应用程序的日志如下所示。我尝试上网冲浪但没有成功,可能是什么问题?非常感谢您的帮助

07-10 11:55:26.256 D/DynamitePackage( 4834): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
07-10 11:55:26.261 I/Ads     ( 4834): This request is sent from a test device.
07-10 11:55:26.318 I/DynamiteModule( 4834): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
07-10 11:55:26.318 I/DynamiteModule( 4834): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
07-10 11:55:27.069 W/Ads     ( 4834): JS: A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032. (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html:0)[INFO:CONSOLE(0)] "A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (0)

07-10 11:55:27.069 I/chromium( 4834): [INFO:CONSOLE(0)] "A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (0)
07-10 11:55:27.707 I/art     ( 4834): Background sticky concurrent mark sweep GC freed 2254(133KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 12MB/12MB, paused 7.259ms total 26.738ms
07-10 11:55:27.789 I/art     ( 4834): Background sticky concurrent mark sweep GC freed 481(35KB) AllocSpace objects, 3(220KB) LOS objects, 0% free, 12MB/12MB, paused 56.403ms total 65.828ms
07-10 11:55:28.177 I/DynamiteModule( 4834): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
07-10 11:55:28.177 I/DynamiteModule( 4834): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
[0:] 
Ad just loaded = (this point is the OnLoaded() listerner event)
07-10 11:55:28.225 E/chromium( 4834): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
07-10 11:55:28.226 E/chromium( 4834): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw07-10 11:55:28.336 E/chromium( 4834): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

07-10 11:55:28.337 E/chromium( 4834): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

另一个来自单独 运行 的日志:

07-10 12:02:22.996 D/DynamitePackage( 5094): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
07-10 12:02:23.001 I/Ads     ( 5094): This request is sent from a test device.
07-10 12:02:23.039 I/DynamiteModule( 5094): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
07-10 12:02:23.039 I/DynamiteModule( 5094): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
[INFO:CONSOLE(0)] "A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (0)
07-10 12:02:23.798 W/Ads     ( 5094): JS: A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032. (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html:0)
07-10 12:02:23.798 I/chromium( 5094): [INFO:CONSOLE(0)] "A cookie associated with a resource at http://doubleclick.net/ was set with `SameSite=None` but without `Secure`. A future release of Chrome will only deliver cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (0)
07-10 12:02:24.374 I/art     ( 5094): Background sticky concurrent mark sweep GC freed 415(25KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 12MB/12MB, paused 6.902ms total 15.970ms
07-10 12:02:24.959 I/DynamiteModule( 5094): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
07-10 12:02:24.959 I/DynamiteModule( 5094): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
[0:] 
Ad just loaded = (this point is the OnLoaded() listerner event)
[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
07-10 12:02:25.023 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

07-10 12:02:25.024 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw07-10 12:02:25.143 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw07-10 12:02:25.144 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

07-10 12:03:35.001 I/Ads     ( 5094): This request is sent from a test device.
07-10 12:03:35.944 I/DynamiteModule( 5094): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
07-10 12:03:35.944 I/DynamiteModule( 5094): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
07-10 12:03:35.962 W/Ads     ( 5094): #004 The webview is destroyed. Ignoring action.
07-10 12:03:35.965 W/Ads     ( 5094): #004 The webview is destroyed. Ignoring action.
07-10 12:03:35.966 W/Ads     ( 5094): #004 The webview is destroyed. Ignoring action.
[0:] 
Ad just loaded
07-10 12:03:35.992 W/Ads     ( 5094): #004 The webview is destroyed. Ignoring action.
07-10 12:03:35.994 W/Ads     ( 5094): #004 The webview is destroyed. Ignoring action.
07-10 12:03:36.478 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw07-10 12:03:36.480 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw07-10 12:03:36.586 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

07-10 12:03:36.587 E/chromium( 5094): [ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw
[ERROR:tile_manager.cc(779)] WARNING: tile memory limits exceeded, some content may not draw

我遇到了完全相同的问题,现在已经解决了。

首先: 1- 推荐你使用这个 nuget 包: https://github.com/marcojak/TestMTAdmob

2- Thr 广告只展示一次,因为您没有尺码。我正是用这段代码解决了这个问题:

<admob:MTAdView x:Name="myAds" IsVisible="true" PersonalizedAds="true" AdsId="ca-app-pub-3940256099942544/6300978111" VerticalOptions="EndAndExpand" >
                <admob:MTAdView.HeightRequest>
                    <x:OnIdiom>
                        <x:OnIdiom.Phone>50</x:OnIdiom.Phone>
                        <x:OnIdiom.Tablet>90</x:OnIdiom.Tablet>
                        <x:OnIdiom.Desktop>90</x:OnIdiom.Desktop>
                    </x:OnIdiom>
                </admob:MTAdView.HeightRequest>
            </admob:MTAdView>