Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 应用程序上会显示测试广告,但真实广告不会显示_C#_Unity3d_Admob - Fatal编程技术网

C# 应用程序上会显示测试广告,但真实广告不会显示

C# 应用程序上会显示测试广告,但真实广告不会显示,c#,unity3d,admob,C#,Unity3d,Admob,我正在使用unity和admob,现在我遇到了一个问题 当我尝试显示测试广告时,他们会毫无问题地显示,一切正常,但当我尝试显示真实广告时,他们不会显示 我尝试了以下方法: 我创建了admob帐户 我将AppID压缩到代码中,也压缩到xml文件中 我做了从turorials开始的所有事情,做了一些更改,因为google不知道如何解释 java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.Mobil

我正在使用unity和admob,现在我遇到了一个问题 当我尝试显示测试广告时,他们会毫无问题地显示,一切正常,但当我尝试显示真实广告时,他们不会显示

我尝试了以下方法: 我创建了admob帐户 我将AppID压缩到代码中,也压缩到xml文件中 我做了从turorials开始的所有事情,做了一些更改,因为google不知道如何解释

java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
10-08 22:24:53.917 30153 30153 E AndroidRuntime: 
10-08 22:24:53.917 30153 30153 E AndroidRuntime: ******************************************************************************
10-08 22:24:53.917 30153 30153 E AndroidRuntime: * Invalid application ID. Follow instructions here:                          *
10-08 22:24:53.917 30153 30153 E AndroidRuntime: * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
10-08 22:24:53.917 30153 30153 E AndroidRuntime: * to find your app ID.
这是我显示横幅的代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;

public class AdmobManager : MonoBehaviour
{
    private BannerView bannerView;
    void Start()
    {
        #if UNITY_ANDROID
            string appId = "ca-app-pub-6068823890509836~9548685797";
        #elif UNITY_IPHONE
            string appId = "ca-app-pub-3940256099942544~1458002511";
        #else
            string appId = "unexpected_platform";
        #endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        this.RequestBanner();
    }

    // Update is called once per frame
    private void RequestBanner()
    {
        #if UNITY_ANDROID
            string adUnitId = "ca-app-pub-6068823890509836/3679968367";
        #elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/2934735716";
        #else
            string adUnitId = "unexpected_platform";
        #endif

        // Create a 320x50 banner at the top of the screen.
        bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();

        // Load the banner with the request.
        bannerView.LoadAd(request);
    }
}
这是我的xml文件

> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.google.unity.ads" android:versionName="1.0"
> android:versionCode="1">   <application>
>     <uses-library android:required="false" android:name="org.apache.http.legacy" />
>     <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
> android:value="ca-app-pub-6068823890509836~9548685797" />  
> </application> </manifest>
>xmlns:android=”http://schemas.android.com/apk/res/android"
>package=“com.google.unity.ads”android:versionName=“1.0”
>android:versionCode=“1”>
>     
>android:value=“ca-app-pub-6068823890509836~9548685797”/
>  

我昨天也做了横幅,所以24小时过去了。

如果已经播放了测试广告,我不认为你有什么问题

一旦你的应用程序发出更多请求,你就会看到更一致的结果。请注意,测试广告通过与直播广告相同的渠道运行。能够返回测试广告可确保您的应用程序与我们的网络正常通信

资料来源: