0

In my react-native project there are 2 packages using googles exoplayer. One uses version 2.7.0 and the one i'm trying to add right now is using 2.9.0. After adding i got

Android dependency 'com.google.android.exoplayer:exoplayer-core' has             
different version for the compile (2.7.0) and runtime (2.9.2) 
classpath. You should manually set the same version via 
DependencyResolution

According to

Android dependency has different version for the compile and runtime

i tried adding

subprojects {
  project.configurations.all {
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.google.android.exoplayer'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "2.9.2"
        }
     }
  }
}

to my /android/build.gradle

but now i get

Could not resolve all files for configuration ':react-native-track- 
player:debugCompileClasspath'.
> Could not find support-compat.jar (com.android.support:support- 
compat:27.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support- 
compat/27.1.1/support-compat-27.1.1.jar

i thought maybe it should use support-compat-28.0.0.jar and also added

        if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "28.0.0"
        }

but now i get

error: failed linking references.
:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to process resources, see aapt output above for details.

Actually i have no real clue what i'm doin here, its my first time modifying a gradle file... would love to get some help

the complete build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def keystorePropertiesFile = rootProject.file("./keystores/release.keystore.properties")

def keystoreProperties = new Properties()

keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 51
        versionName "0.0.51"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false 
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

repositories {
    maven {
        url 'http://repo.brightcove.com/releases'
    }
}

dependencies {
    compile project(':react-native-track-player')
    compile project(':react-native-share')
    compile project(':react-native-fs')
    compile project(':react-native-check-notification-enable')
    compile project(':react-native-passkit-wallet')
    compile project(':rn-fetch-blob')
    compile project(':react-native-orientation-locker')
    compile project(':react-native-brightcove-player')
    compile project(':react-native-vector-icons')
    compile project(':react-native-onesignal')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"
    implementation 'com.android.support:multidex:1.0.3'
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
DeepValue
  • 54
  • 4

0 Answers0