java - 错误 : Failed to resolve: com. google.girebase :firebase-core:16. 2.0

标签 java android gmsplacepicker

添加 Google 地点新库时遇到错误

implementation 'com.google.android.libraries.places:places:1.1.0'

我尝试了 this 中的所有解决方案问题。

dependencies {
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
        transitive = true;
    }
    implementation project(path: ':calendar')
    implementation 'com.google.firebase:firebase-core:11.0.4'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.applozic.communication.uiwidget:mobicomkitui:5.8.6'
    implementation 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.android.gms:play-services-location:11.0.4'
    implementation 'com.google.android.gms:play-services-places:11.0.4'
    implementation 'com.google.android.gms:play-services-base:11.0.4'
    implementation 'com.google.android.gms:play-services-identity:11.0.4'
    implementation 'com.google.android.gms:play-services-auth-api-phone:11.0.4'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'com.daimajia.easing:library:2.0@aar'
    implementation 'com.daimajia.androidanimations:library:2.2@aar'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'me.relex:circleindicator:1.2.2@aar'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.github.applikeysolutions:cosmocalendar:1.0.4'
    implementation 'com.google.maps.android:android-maps-utils:0.4.4'
    implementation 'com.android.support:multidex:1.0.0'
    implementation 'com.hbb20:ccp:2.2.2'
    implementation 'com.github.GoodieBag:Pinview:v1.3'
    implementation 'com.crystal:crystalrangeseekbar:1.0.0'
    implementation 'com.github.douglasjunior.BetterSpinner:library:bugfix-1.1.0-2'
    implementation 'com.github.mabbas007:TagsEditText:1.0.5'
    implementation 'com.github.vihtarb:tooltip:0.1.9'
    implementation 'com.github.warkiz:IndicatorSeekBar:v1.2.1'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation 'com.github.broakenmedia:MultiContactPicker:1.7'
    testImplementation 'junit:junit:4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.15'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.dc.easyadapter:easyadapter:2.0.3'
    implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
    kapt 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.jakewharton.timber:timber:4.5.1'
    implementation 'com.google.dagger:dagger:2.19'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.19'
    implementation 'com.google.dagger:dagger-android:2.19'
    implementation 'com.google.dagger:dagger-android-support:2.19'
    implementation 'com.andrognito.flashbar:flashbar:1.0.2'
    implementation 'com.laimiux.rxnetwork:rxnetwork:0.0.4'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
    debugINImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
    debugDEImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
    stagingImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
    implementation 'android.arch.persistence.room:runtime:1.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    kapt "android.arch.persistence.room:compiler:1.1.1"
    // if you use the support libraries
    kapt 'com.google.dagger:dagger-android-processor:2.19'

}

======================================================================

buildscript {
    ext.kotlin_version = '1.3.0'
    repositories {
        google()
        repositories {
            google()
            jcenter()
            mavenCentral()
            maven { url 'https://maven.fabric.io/public' }
            maven { url 'https://plugins.gradle.org/m2/'}
        }

    }

    dependencies {
//        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {

        repositories {
            google()
            jcenter()
            maven { url "https://jitpack.io" }
            mavenCentral()
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext.deps = [
        // Test dependencies
        junit      : 'junit:junit:4.10',
        festandroid: 'com.squareup:fest-android:1.0.7',
        robolectric: 'org.robolectric:robolectric:2.2',
        intellijannotations: 'com.intellij:annotations:12.0'
]

需要将项目与新的 Google Places SDK 同步

最佳答案

由于您使用一个信号,因此它使用旧版本的 12.0.1 firebase 和 gms 库,为此您需要添加一个分辨率策略以转换为所需版本

您可以从 build.gradle 文件中删除它,因为 firebase-messaging 在其他库中使用:

implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'

在您的应用 build.gradle 文件中使用此文件并将 Google 服务版本更新至 16.0.0

implementation 'com.applozic.communication.uiwidget:mobicomkitui:5.8.6'
implementation 'com.onesignal:OneSignal:3.11.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'

implementation 'com.google.android.libraries.places:places:1.1.0'

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested

        if (requested.group == 'com.google.android.gms' && (requested.name == 'play-services-measurement-base')) {
            details.useVersion '15.0.2'  //use a common gms version here
        }

        if (requested.group == 'com.google.android.gms' && (requested.name == 'play-services-basement')) {
            details.useVersion '15.0.1'  //use a common gms version here
        }

        if(requested.group == 'com.google.firebase' && requested.name == 'firebase-messaging'){
            details.useVersion '15.0.0'
        }

        if(requested.group == 'com.google.firebase' && requested.name == 'firebase-iid'){
            details.useVersion '16.0.0'
        }

        if(requested.group == 'com.google.firebase' && requested.name == 'firebase-analytics-impl'){
            details.useVersion '15.0.2'
        }
    }
}

我只尝试过上述依赖项。我尚未添加您在应用程序中使用的所有其他依赖项

您可以分析应用程序依赖项并查看哪些版本库正在使用 Android Studio 终端中的以下命令

 ./gradlew app:dependencies

关于java - 错误 : Failed to resolve: com. google.girebase :firebase-core:16. 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57073966/

相关文章:

Android Espresso - 测试不同的 Activity

java - 处理短数据类型的变量

java - 如何为要进行基准测试的函数提供随机输入?

java - 插入数据, "MobileServiceTable must have a single id property defined"

java - 设计具有可交换处理程序代码的通用处理程序类?

java - org.triten.bp.format.DateTimeParseException : Text '2018-07-22T14:00:00-03:00' could not be parsed at index 19

android - 单击对话框的正按钮后无法将数据保存到 sharedPreferences

swift - 循环更新 URL 的 API 请求

android - 警报对话框按钮太近

android - 我可以在 PlacePicker.IntentBuilder 中设置 LatLngObject 以查看 map 中的那个地方吗?