fix: add stub for IMA and option to enable it on demand

This commit is contained in:
olivier
2023-02-07 23:14:50 +01:00
parent 0e0ff18b27
commit 57b4a76775
4 changed files with 106 additions and 1 deletions

View File

@@ -4,6 +4,18 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false)
println "useExoplayerIMA:" + useExoplayerIMA
// This string is used to define build path.
// As react native build output directory is react-native path of the module.
// We need to force a new path on each configuration change.
// If you add a new build parameter, please add the new value in this string
def configStringPath = (
'useExoplayerIMA' + useExoplayerIMA \
).md5()
android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
@@ -24,6 +36,19 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildDir 'buildOutput_' + configStringPath
sourceSets {
main {
java {
if (useExoplayerIMA) {
exclude 'com/google/ads/interactivemedia/v3/api'
exclude 'com/android/exoplayer2/ext/ima'
}
}
}
}
}
repositories {
@@ -45,7 +70,9 @@ dependencies {
implementation('com.google.android.exoplayer:extension-okhttp:2.18.1') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
implementation 'com.google.android.exoplayer:extension-ima:2.18.1'
if (useExoplayerIMA) {
implementation 'com.google.android.exoplayer:extension-ima:2.18.1'
}
implementation "com.squareup.okhttp3:okhttp:" + '$OKHTTP_VERSION'
}