Android зависимость имеет другую версию - Разрешение не работает - PullRequest
0 голосов
/ 05 февраля 2019

В моем реактивном проекте есть 2 пакета, использующих googles exoplayer.Один использует версию 2.7.0, а тот, который я сейчас пытаюсь добавить, использует 2.9.0.После добавления я получил

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

Согласно

Зависимость Android имеет другую версию для компиляции и среды выполнения

Я попытался добавить

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"
        }
     }
  }
}

на мой /android/build.gradle

но теперь я получаю

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

я подумал, может быть, он должен использовать support-compat-28.0.0.jar, а также добавил

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

но теперь я получаю

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.

На самом деле я понятия не имею, что я делаю здесь, это мой первый раз, когда я изменяю файл gradle ... хотел бы получитьнекоторая помощь

полный 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"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...