Fabric crashlytics 与本机错误反应

Fabric crashlytics with react native error

我正在努力将 Fabric crashlytics 集成到 android 反应本机应用程序中 tutorial。但是在使用 react-native install react-native-fabric 安装 Fabric 包后,我尝试使用 npm run android 为应用程序提供午餐,我收到了这个错误:

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

我的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"
}

这是 react-native-fabric 自己的 build.gradle 文件...以及 JCenter maven 存储库的问题。

在他们的 github 上查看这个问题: https://github.com/corymsmith/react-native-fabric/issues/200

基本上,您可以通过直接编辑 node_module/react-native-fabric/android/build.gradle 文件来解锁自己(更改 Maven 存储库顺序,将 Jcenter 向下移动 Google)

他们必须为此修复发布 NPM 版本...

编辑

实际上,如果您不想编辑 node_module。 build.gradle,您可以在根项目 build.gradle (android/build.gradle) 中覆盖此设置。这是我修复它的配置(我不是 Gradle 专家,你的可能不同)

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

}