我正在按照以下tutorial的要求将 Fabric crashlytics 集成到android react native应用中。但是在使用react-native install react-native-fabric
安装Fabric软件包后,我尝试与npm run android
吃午餐,出现了这个错误:
配置项目':react-native-fabric'时出现问题。
无法解析配置':react-native-fabric:classpath'的所有文件。
找不到lint-gradle-api.jar(com.android.tools.lint:lint-gradle-api:26.1.2)。 在以下位置搜索: 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"
}
答案 0 :(得分:7)
这是git push
自己的build.gradle文件和JCenter maven存储库的问题。
在他们的github上查看此问题: https://github.com/corymsmith/react-native-fabric/issues/200
基本上,您可以通过直接编辑react-native-fabric
文件(更改Maven存储库顺序,将Jcenter移至Google下方)来解除封锁自己的状态
此修补程序他们必须发布NPM版本...
编辑
实际上,如果您不想编辑node_module/react-native-fabric/android/build.gradle
。 build.gradle,您可以在根项目build.gradle(node_module
)中覆盖此设置。这是修复它的配置(我不是Gradle专家,您的可能有所不同)
android/build.gradle