React Native: Error while building project
Asked Answered
P

1

1

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)

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

I have no idea what's going on

looking forward for much need help

thank you

Pretension answered 14/5, 2018 at 6:32 Comment(6)
What is your google-services version?Questionless
Hey @MRFrhn thank you for your response, classpath 'com.android.tools.build:gradle:3.1.2' classpath 'com.google.gms:google-services:3.3.0'Pretension
i have changed com.android.tools.build:gradle:3.1.2 to 2.3.3 in main build.gradlew file now i'm not getting that error, but how do i updrade the build.gradlew to new version without getting any errorsPretension
keep the gradle version, change google-services to classpath 'com.google.gms:google-services:3.2.1' and try again. there seems to be an issue with 3.3.0 versionQuestionless
Thank you! that worked fine. and can I use play-services:15.0.1 currently I am using 11.8.0.Pretension
Ok so I'll post it as an answer to be helpful for others too :) I think you're ok to use thatQuestionless
Q
3

There seems to be an issue with google-services 3.3.0

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

Questionless answered 14/5, 2018 at 7:34 Comment(3)
ok now i'm getting this error, Gradle sync failed: Could not find com.android.tools.build:gradle:3.1.2. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar Required by: project :react-native-fetch-blob Consult IDE log for more details (Help | Show Log) (20s 292ms)Pretension
Change gradle to 3.2.1Questionless
if use com.android.tools.build:gradle:2.3.3 everything works finePretension

© 2022 - 2024 — McMap. All rights reserved.