【发布时间】:2019-01-19 01:57:44
【问题描述】:
今天尝试更新一个旧项目时,我遇到了一个问题(在 Android 上),我认为这与其中一个 Firebase 插件有关。 我不断收到以下错误:
FAILURE:构建失败并出现异常。
出了什么问题:
库 com.google.android.gms:play-services-base 正在 [[15.0.1,15.0.1]] 的各种其他库请求,但解析为 11.8.0。禁用插件并使用 ./gradlew :app:dependencies 检查你的依赖树。
这是我的 pubspec 文件中的一个 sn-p,用于显示我项目中的插件:
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.5.18
firebase_storage: ^1.0.1
cloud_firestore: ^0.7.4
firestore_helpers: ^2.0.5
image_picker: ^0.2.0
location: 1.1.6
flutter_webview_plugin: 0.0.9+1
font_awesome_flutter: 4.7.2
flutter_map: ^0.0.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.0
此 sn-p 显示项目的当前状态,以及 Firebase 产品的所有新版本。
当然,我也更新了我的build.gradle 文件,它们看起来像这样的atm:
Android 级 build.gradle 文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级 build.gradle 文件:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withInputStream { stream ->
localProperties.load(stream)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.test.tester"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
profile {
matchingFallbacks = ['debug', 'release']
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
我相信这就是我根据文档必须做的所有事情,但也许我错过了一些东西。
有人知道如何解决这个问题吗?
【问题讨论】:
-
删除
firestore_helpers: ^2.0.5并尝试重新构建它