LoginSignup
2
0

More than 3 years have passed since last update.

UnityAdMobPluginアプデ時のエラー対処方法

Posted at

はじめに

AdMobプラグインアップデート後に以下のエラーがiOS/Android共に発生

The Google Mobile Ads SDK was initialized incorrectly

実装環境

  • Unity 2019.1.4f1
  • Google Mobile Ads Unity Plugin v3.17

対処方法

AppIDの設定箇所が重複しているため、以下のファイルの該当部分をコメントアウト
もしくはAppIDをセットする

iOS

GoogleMobileAds/Editor/PListProcessor.cs
using System.IO;

using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public static class PListProcessor
{
    [PostProcessBuild]
    public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    {
        // Replace with your iOS AdMob app ID. Your AdMob App ID will look
        // similar to this sample ID: ca-app-pub-3940256099942544~1458002511

        //以下の部分をコメントアウト
        /*
        string appId = "ADMOB_APPLICATION_ID";

        string plistPath = Path.Combine(path, "Info.plist");
        PlistDocument plist = new PlistDocument();

        plist.ReadFromFile(plistPath);
        plist.root.SetString("GADApplicationIdentifier", appId);
        File.WriteAllText(plistPath, plist.WriteToString());
        */
    }
}

Android

Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.unity.ads"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="14"
      android:targetSdkVersion="19" />
  <application>
    <uses-library android:required="false" android:name="org.apache.http.legacy"/>
    <!-- Your AdMob App ID will look similar to this sample ID: ca-app-pub-3940256099942544~3347511713 -->

<!-- 以下の部分をコメントアウト -->

<!--    <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="[ADMOB APPLICATION ID]"/>
 -->
  </application>
</manifest>

参考リンク

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0