在我的本机项目中,有2个使用Google 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 dependency has different version for the compile and runtime
我尝试添加
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"