React Native:构建项目时出错 [英] React Native: Error while building project

查看:166
本文介绍了React Native:构建项目时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初,一切正常,我试图更新build:gradle和SDK版本

Initially, everything was working fine, I was trying to update the build:gradle and SDK versions

在构建项目时会得到以下提示

I am getting the following while building the project

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文件

Below is the build.gradlew file of react-native-fetch-blob

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 3.3.0似乎有问题

There seems to be an issue with google-services 3.3.0

将其更改为classpath 'com.google.gms:google-services:3.2.1',它应该可以正常工作.

Change it to classpath 'com.google.gms:google-services:3.2.1' and it should work fine.

这篇关于React Native:构建项目时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆