在将firebase,cloud_firebase和带有google-services.json的firestore添加到android \ app后。 我收到了不兼容的错误。 我尝试了几次搜索以确定可能的解决方案,但我做不到。 这是错误:
失败:生成失败,发生异常。 *出了什么问题:
无法确定任务':app:preDebugBuild'的依赖关系。
在项目“应用”中,已解析的Google Play服务库依赖项依赖于另一个版本(例如“ [16.0。
0]”,但尚未解决该版本。该库显示的行为将是未知的。
依赖项失败:com.google.firebase:firebase-measurement-connector-impl:16.0.1-> com.google.android.gms:play-servic
es-measurement-base @ [16.0.0],但基于play-services-measurement-base的版本为17.2.0。
以下依赖关系是直接的项目依赖关系,或者具有导致艺术发展的传递依赖关系
解决问题。
-项目“应用”取决于com.google.android.gms:play-services-measurement-sdk@17.2.0
-项目“应用”取决于com.google.android.gms:play-services-measurement-impl@17.2.0
-项目“应用”取决于com.google.firebase:firebase-core@16.0.1
-项目“应用”取决于com.google.firebase:firebase-analytics-impl@16.1.1
-项目“应用”取决于com.google.firebase:firebase-analytics@17.2.0
-项目“应用”取决于com.google.firebase:firebase-measurement-connector-impl@16.0.1
-项目“应用”取决于com.google.android.gms:play-services-measurement-base@17.2.0
-项目“应用”取决于com.google.android.gms:play-services-measurement@17.2.0
-项目“应用”取决于com.google.android.gms:play-services-measurement-api@17.2.0
-项目“应用”取决于com.google.android.gms:play-services-measurement-sdk-api@17.2.0
有关扩展调试信息,请从命令行使用./gradlew --info:app:assembleDebug执行Gradle以查看dep
工件的路径。此错误消息来自google-services Gradle插件,请通过https://
报告问题github.com/google/play-services-plugins并通过在您的b中添加“ googleServices {disableVersionCheck = false}”来禁用
uild.gradle文件。
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。与--scan一起运行以获得完整的见解。
在1m 47s内失败 正在运行Gradle任务'assembleDebug'... 110.0s Gradle任务assembleDebug失败,退出代码为1
HMy android \ build.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的android \ app \ build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
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.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'kotlin-android'
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ecommerce"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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
}
}
}
flutter {
source '../..'
}
dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.android.support:support-v4:27.1.1"
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
我的gradle-wrapper.properties:
23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip