Monaca/admob/admob-free/mediation/他
提供: 初心者エンジニアの簡易メモ
目次
他色々のメディエーションを使いたい場合
androidの場合
androidでは以下をplugin.xmlに追加する
<platform name="android"> <framework src="build-extras.gradle" custom="true" type="gradleReference"/> <framework src="com.unity3d.ads:unity-ads:+" /> <framework src="com.google.ads.mediation:unity:+" /> <framework src="com.facebook.android:audience-network-sdk:+" /> <framework src="com.google.ads.mediation:facebook:+" /> <framework src="net.nend.android:nend-sdk:5.4.2" /> <framework src="com.google.ads.mediation:nend:+" /> <framework src="com.android.support:appcompat-v7:26.1.0" /> <framework src="com.android.support.constraint:constraint-layout:1.1.3" /> <framework src="com.google.android.gms:play-services-basement:15.0.1" /> <framework src="com.google.android.gms:play-services-ads:15.0.1" /> <framework src="com.google.android.gms:play-services-location:15.0.1" /> <dependency id="cordova-plugin-enable-multidex" /> </platform>
以下エラーが発生する場合
> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. > Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0). Required by: project :app > com.google.android.gms:play-services-location:15.0.1 project :app > com.google.android.gms:play-services-places-placereport:15.0.1 > Failed to list versions for com.google.android.gms:play-services-basement.
おそらくversionが競合してるので、以下のように、15.0.1にするとか
<framework src="com.google.android.gms:play-services-basement:15.0.1" />
以下エラーが発生する場合
> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. > Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0). Required by: project :app > com.google.android.gms:play-services-location:15.0.1 > Failed to list versions for com.google.android.gms:play-services-tasks.
おそらくversionが競合してるので、以下のように、15.0.1にするとか
<framework src="com.google.android.gms:play-services-tasks:15.0.1" />
maven設定方法
plugin.xml
<platform name="android"> <framework src="build-extras.gradle" custom="true" type="gradleReference"/> </platform>
build-extras.gradle
ext.postBuildExtras = { allprojects { repositories { maven { url "https://maven.google.com" } jcenter() maven { url 'http://fan-adn.github.io/nendSDK-Android-lib/library' } maven { url 'https://github.com/zucks/ZucksAdNetworkSDK-Maven/raw/master/' } maven{ url "https://imobile-maio.github.io/maven" } maven { url "https://adcolony.bintray.com/AdColony" } } } android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } configurations.all { resolutionStrategy { force 'com.android.support:support-v4:26.+' } } }
以下Zucksエラーが起こるとき
Could not determine the dependencies of task ':app:preDebugBuild'. > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not find net.zucks:zucks-ad-network-sdk:4.6.1.
gradleに以下を追加
maven { url 'https://github.com/zucks/ZucksAdNetworkSDK-Maven/raw/master/' }
以下maioエラーが起こるとき
Could not determine the dependencies of task ':app:preDebugBuild'. > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not find com.maio:android-sdk:1.1.6.
gradleに以下を追加
maven{ url "https://imobile-maio.github.io/maven" }
basementの競合エラーのとき
Could not determine the dependencies of task ':app:preDebugBuild'. > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. > Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
plugin.xmlに以下のようにバージョンを15.0.1へ
<framework src="com.google.android.gms:play-services-basement:15.0.1" />
tasksの競合エラーのとき
> Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0). Required by: project :app > com.google.android.gms:play-services-location:15.0.1 > Failed to list versions for com.google.android.gms:play-services-tasks.
plugin.xmlに以下のようにバージョンを15.0.1へ
<framework src="com.google.android.gms:play-services-tasks:15.0.1" />
transformClassesWithDexBuilderForDebugエラーが出るとき
以下エラーが出るとき
Task :app:transformClassesWithDexBuilderForDebug
androidxとandroid.supportとの競合的な( https://translate.google.com/translate?sl=en&tl=ja&u=https://github.com/flutter/flutter/issues/25271 ) 情報があったので、android.supportを切ってみる。
build-extras.gradle
configurations.all { resolutionStrategy { // force 'com.android.support:support-v4:26.+' } }
後は、以下のようにandroid.supportをandroidxへ
修正前
<framework src="com.android.support:appcompat-v7:26.1.0" /> <framework src="com.android.support.constraint:constraint-layout:1.1.3" />
修正後
<framework src="androidx.appcompat:appcompat:1.1.0" /> <framework src="androidx.cardview:cardview:1.0.0" /> <framework src="androidx.constraintlayout:constraintlayout:1.1.3" /> <framework src="androidx.percentlayout:percentlayout:1.0.0" />
うーん・・。解決できず。
iosの場合
plugin.xmlに追加
<platform name="ios"> <pods use-frameworks="true"> <pod name="GoogleMobileAdsMediationUnity" spec="~> 3.1"/> <pod name="GoogleMobileAdsMediationFacebook" spec="~> 5.4" /> <pod name="GoogleMobileAdsMediationNend" spec="~> 5.4.1.0" /> </pods> </platform>