【发布时间】:2018-05-14 06:32:32
【问题描述】:
最初,一切正常,我正在尝试更新 build:gradle 和 SDK 版本
我在构建项目时得到以下信息
Gradle sync failed: More than one variant of project :react-native-fetch-blob matches the consumer attributes:
- Configuration ':react-native-fetch-blob:debugApiElements' variant android-aidl:
- Found artifactType 'android-aidl' but wasn't required.
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration ':react-native-fetch-blob:debugApiElements' variant android-classes:
- Found artifactType 'android-classes' but wasn't required.
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'debug' but wa... (show balloon)
下面是 react-native-fetch-blob 的 build.gradlew 文件
apply plugin: 'com.android.library'
repositories {
mavenCentral()
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.facebook.react:react-native:+'
//{RNFetchBlob_PRE_0.28_DEPDENDENCY}
}
我不知道发生了什么
期待大家的帮助
谢谢
【问题讨论】:
-
您的
google-services版本是什么? -
嘿@MRFrhn 谢谢你的回复,
classpath 'com.android.tools.build:gradle:3.1.2' classpath 'com.google.gms:google-services:3.3.0' -
我已将主
build.gradlew文件中的com.android.tools.build:gradle:3.1.2更改为2.3.3,现在我没有收到该错误,但是如何将build.gradlew升级到新版本而不会出现任何错误 -
保留 gradle 版本,将 google-services 更改为
classpath 'com.google.gms:google-services:3.2.1'并重试。 3.3.0版本好像有问题 -
谢谢!效果很好。我可以使用
play-services:15.0.1吗?目前我使用的是 11.8.0。
标签: android react-native mobile react-native-fetch-blob