LoginSignup
11
9

More than 5 years have passed since last update.

いつのまにか新しくなった。Unity Admob+Applovinメディエーションの広告SDK導入

Last updated at Posted at 2018-09-07

いつもまにか、Unityでのadmobメディエーションで、AppLovinの導入が新しくなって、
使いやすくなってました。

GDPRの考慮もされていていい感じ。

いままではこちら記事をめちゃくちゃ参考にしながら対応していました。
すごいお世話になりました。m( _ _ )m
http://games.genieus.co.jp/unity/unity_admob_applovin/

新方法

上記の通りやっていればほぼOKでした!

管理画面など設定手順は、記載の通りなので。SDKの導入部分からざっくりショートカット!

主に動画リワードのadmobメディエーションで、Applovinを配信するという流れです。

1. admobのunitypackage版をUnityにインポート

https://github.com/googleads/googleads-mobile-unity/releases
こっから(2018-09-06時点)最新版のv3.15.1をDL。

image.png

そして、Unityにインポート

2. AppLovinメディエーション用パッケージの導入

https://developers.google.com/admob/unity/mediation/applovin
の通りに、

https://bintray.com/google/mobile-ads-adapters-unity/GoogleMobileAdsAppLovinMediation#files/GoogleMobileAdsAppLovinMediation%2F3.1.1
※GoogleMobileAdsAppLovinMediation-4.0.0もiOSはビルド通りました。

ここからメディエーション用パッケージをDLし、
Unityにインポート!

3. あとは、admobとapplovinの初期化をすればOK

僕はいままで、こんな感じで、singletonで初期化、ロード、コールバックを書いてましたが、
https://qiita.com/matsuyoro/items/33d723fdef798f74d286
動かなくなっていてなんだろうと思ったら、
初期化メソッドが若干変わってました。

注意!いままでは、
AppLovin.InitializeSDK()でしたが。

AppLovin.Initialize()

とSDKがなくなってるのに、注意。

また、

AppLovin.SetSdkKey();

も使えなくなっているので、
https://developers.google.com/admob/unity/mediation/applovin
の通り、

iOS用の

rootDict.SetString("AppLovinSdkKey",
                   "YOUR_SDK_KEY_HERE");


Android用の

<meta-data android:name="applovin.sdk.key"
    android:value="YOUR_SDK_KEY_HERE" />

でsdkkeyは指定する。

あとは、GDPR云々の設定するしないなど。

以上です。
雑になってしまい申し訳ないです。。!
(あとで修正したい!

トラブルシューティング

iOSで下記エラーで、xcworkspaceファイルが出力されなかったので、


iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.

pod install output:

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "GoogleMobileAdsMediationAppLovin":
  In Podfile:
    GoogleMobileAdsMediationAppLovin (= 6.2.0.0)

Specs satisfying the `GoogleMobileAdsMediationAppLovin (= 6.2.0.0)` dependency were found, but they required a higher minimum deployment target.





pod repo update output:

Updating spec repo `master`
  $ /usr/bin/git -C /Users/hogehoge/.cocoapods/repos/master fetch origin --progress
  $ /usr/bin/git -C /Users/hogehoge/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/hogehoge/.cocoapods/repos/master reset --hard origin/master
  HEAD is now at 5b30794b76e [Add] HZNavigationBar 1.0.2

CocoaPods 1.7.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.7.0.beta.1

image.png]

エラーの通り、
cocoapodsのバージョンをあげ、

$ sudo gem install cocoapods --pre

※不安だけど現時点でbeta版の1.7.0.beta.1に更新

それでもまだエラーがでていたので、

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.

pod install output:

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "GoogleMobileAdsMediationAppLovin":
  In Podfile:
    GoogleMobileAdsMediationAppLovin (= 6.2.0.0)

Specs satisfying the `GoogleMobileAdsMediationAppLovin (= 6.2.0.0)` dependency were found, but they required a higher minimum deployment target.





pod repo update output:

Updating spec repo `master`

targetバージョンを8.1から9.0に変えたら無事ビルドが通りました。

image.png

11
9
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
11
9