0
votes

I'm working in integrating Fabric crashlytics in android react native app following this tutorial. But after installing Fabric package using react-native install react-native-fabric I try to lunch the app with npm run android I got this error:

A problem occurred configuring project ':react-native-fabric'.

Could not resolve all files for configuration ':react-native-fabric:classpath'.

Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

My build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
        googleServicesVersion = "17.1.0"
    }

    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'

    }
}


plugins {
    id 'com.palantir.git-version' version '0.11.0'
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

        maven {
            url "https://maven.google.com"
        }

        maven { url "https://jitpack.io" }
        google()
        maven { url 'https://oss.sonatype.org/service/local/repositories/snapshots/content/' }
        maven { url 'https://oss.sonatype.org/service/local/repositories/releases/content/' }
        jcenter()
    }

    tasks.whenTaskAdded { task ->
        if (task.name.contains("lint")) {
            if (!task.toString().contains("app")) {
                task.enabled = false
            }
        }
    }
}

ext {
    apkCode = 1

    // Apisense dependecies
    apisenseVersion = "1.12.0.beta2"
    apisenseDevVersion = "1.13.1-alpha-SNAPSHOT"
    intentStingVersion = "0.0.1-alpha"
    intentStingDevVersion = "0.0.1-alpha-SNAPSHOT"
}
1
The problem is located in your build.gradle file. Can you please post it?André Sousa
Check this answer out: stackoverflow.com/a/52947028/9564651Vesper
@AndréSousa i'have added the build.gradleAchraf
@Vesper i have already tried thatAchraf

1 Answers

8
votes

This is a problem with react-native-fabric own build.gradle file... and with JCenter maven repository.

Look at this issue on their github : https://github.com/corymsmith/react-native-fabric/issues/200

basically, you can unblock yourself by editing directly the node_module/react-native-fabric/android/build.gradle file (change the maven repositories order, moving Jcenter down Google)

They have to release a NPM version for this fix yet...

EDIT

Actually, if you don't want to edit your node_module. build.gradle, you can override this setting in your root project build.gradle (android/build.gradle). Here's my config that fixed it (I'm no Gradle expert, yours might be different)

allprojects {
    repositories {
        mavenLocal()
        google()

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Firebase : Google Play services from 11.2.0 +
            url 'https://maven.google.com'
        }
        jcenter()
        configurations.all {
            resolutionStrategy {
                // fix dependency problem on react-native-maps 0.20.1
                //force "com.android.support:support-v4:27.1.0"
            }
        }
    }

    buildscript {
        repositories {
            mavenLocal()
            google()

            maven {
                // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                url "$rootDir/../node_modules/react-native/android"
            }
            maven {
                // Firebase : Google Play services from 11.2.0 +
                url 'https://maven.google.com'
            }
            jcenter()
            configurations.all {
                resolutionStrategy {
                    // fix dependency problem on react-native-maps 0.20.1
                    //force "com.android.support:support-v4:27.1.0"
                }
            }
        }
    }

}