我正在运行react-native run-android
,在构建过程中它一直失败。我使用的是最新版本的android studio,我相信所有有关Firebase导入的操作都是正常的(请参阅“将Firebase添加到您的Android App文档和React-native-fcm中)”,因为我正在使用Firebase服务。但是,我一直在运行进入下面的错误,似乎与导入Google服务等有关。
扩展错误消息
* What went wrong:
Failed to capture snapshot of input files for task ':app:checkDebugClasspath' property 'runtimeClasspath' during up-to-date check.
> The library com.google.android.gms:play-services-base is being requested by various other libraries at [[10.2.4,10.2.4]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task ':app:checkDebugClasspath' property 'runtimeClasspath' during up-to-date check.
at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.snapshotTaskFiles(CacheBackedTaskHistoryRepository.java:331)
at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.createExecution(CacheBackedTaskHistoryRepository.java:151)
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
repositories {
jcenter()
google()
// mavenLocal()
// mavenCentral()
// maven {
// url 'https://maven.fabric.io/public'
// name 'Google'
// }
// maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.2'
// classpath 'io.fabric.tools:gradle:1.26.1'
// classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter { url "http://jcenter.bintray.com/"}
}
}
app / build.gradle
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.jast"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-mail')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-picker')
implementation project(':react-native-firebase')
implementation project(':react-native-fetch-blob')
implementation project(':react-native-fcm')
implementation project(':react-native-aws')
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-mail')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-picker')
implementation project(':react-native-firebase')
implementation project(':react-native-fetch-blob')
implementation project(':react-native-fcm')
implementation project(':react-native-aws')
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-mail')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-picker')
implementation project(':react-native-firebase')
implementation project(':react-native-fetch-blob')
implementation project(':react-native-fcm')
implementation project(':react-native-aws')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.firebase:firebase-core:16.0.6"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation "com.google.firebase:firebase-functions:16.1.3"
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'