facebook twitter hatena line email

「Javascript/reactnative/admob/react-native-cli/mediation」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Androidの場合)
(mergeDexが出る場合)
行57: 行57:
 
     The number of method references in a .dex file cannot exceed 64K.
 
     The number of method references in a .dex file cannot exceed 64K.
 
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
 
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
<pre>
+
</pre>
  
 
以下を追加
 
以下を追加

2020年7月22日 (水) 19:20時点における版

Admobメディエーションを使う場合

react-native-cliでAdmobメディエーションを使う場合は、androidであれば、build.gradleへ、iosの場合はPodfileへ追加する。

Androidの場合

android/app/build.gradle

dependencies {
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'com.google.android.gms:play-services-basement:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation 'com.google.ads.mediation:facebook:5.9.0.1'
    implementation 'com.google.ads.mediation:adcolony:4.1.4.1'
    implementation 'com.google.ads.mediation:applovin:9.12.8.0'
    implementation 'com.google.ads.mediation:nend:5.4.2.0'
    implementation 'com.google.ads.mediation:unity:3.4.6.0'
    implementation 'com.google.ads.mediation:maio:1.1.11.1'
}

android/build.gradle

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        google()
        jcenter()
        maven{
            url "https://imobile-maio.github.io/maven"
        }
        maven {
            url  "https://adcolony.bintray.com/AdColony"
        }
        maven {
            url 'http://fan-adn.github.io/nendSDK-Android-lib/library'
        }

ビルドに失敗、アドネットワークは出てない・・・。

mergeDexが出る場合

ビルド時に以下エラーが出る場合

Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

以下を追加

android/app/build.gradle

implementation 'androidx.multidex:multidex:2.0.1'

iOSの場合

以下を追加してpod更新する

ios/Podfile

target 'AdMobMediationDemo' do
  pod 'Google-Mobile-Ads-SDK', '~> 7.41'
  pod 'GoogleMobileAdsMediationUnity', '~> 3.4.6.0'
  pod 'GoogleMobileAdsMediationAdColony', '~> 4.1.5.0'
  pod 'GoogleMobileAdsMediationMaio', '~> 1.5.4.0'
  pod 'GoogleMobileAdsMediationNend', '~> 5.4.1.0'
  pod 'GoogleMobileAdsMediationFacebook', '~> 5.9.0.1'
  pod 'GoogleMobileAdsMediationAppLovin', '~> 6.9.5.0'
  pod 'GoogleMobileAdsMediationTapjoy', '~> 12.4.2.2'
end

更新処理

$ pod update

アドネットワークは出た。