简而言之,当我在我的 APP-LEVEL build.gradle 文件中实现最新版本的 firebase-core(版本 16.0.7)时,当我与 Gradle 文件同步时,它无法下载 firebase 的依赖项之一-核心,称为 firebase-measurement-connector-impl。它搜索版本 17.0.5,但无法下载。
我查看了 Google 的 Maven 存储库 (maven.google.com) 和 mvnrepository.com,版本存在。但是当我尝试自己手动下载 .jar 文件时(使用 Chrome),它也会出错!它说“错误 - 没有文件”。我是在做某事,还是在错过什么(一如既往)?
应用级build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
check.dependsOn 'assembleDebugAndroidTest'
android {
compileSdkVersion 28
flavorDimensions "minSdkVersion"
defaultConfig {
applicationId "me.testweb.firebaseoauthtest"
buildToolsVersion("28.0.3")
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
buildToolsVersion '28.0.3'
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-
annotations:28.0.0'
}
dependencies {
implementation project(':chooser')
implementation project(':lintchecks')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
// Firebase Authentication
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.1.0'
// Google Sign In SDK (only required for Google Sign In)
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// Firebase UI
// Used in FirebaseUIActivity.
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
// Twitter Android SDK (only required for Twitter Login)
implementation 'com.twitter.sdk.android:twitter-core:3.3.0'
implementation 'com.twitter.sdk.android:twitter:3.3.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21"
}
apply plugin: 'com.google.gms.google-services'
项目级build.gradle:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21'
}
}
allprojects {
repositories {
//mavenLocal() must be listed at the top to facilitate testing
mavenLocal()
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
预期的结果是构建过程将成功下载所有内容(包括 firebase-measurement-connector-impl),并且不会显示任何错误。
实际结果是,下载 firebase-measurement-connector-impl 会失败,但一切仍会成功构建(???)。
最佳答案
变化自 实现 'com.google.firebase:firebase-core:16.0.7' 到 实现 'com.google.firebase:firebase-core:16.0.5'
关于android - 与gradle文件同步时无法解析firebase-measurement-connector-impl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54731186/