为了账号安全,请及时绑定邮箱和手机立即绑定

错误:无法解析:com.google.girebase:firebase-core:16.2.0

错误:无法解析:com.google.girebase:firebase-core:16.2.0

隔江千里 2023-03-31 17:28:36
添加 Google places new library 时出现错误实施 'com.google.android.libraries.places:places:1.1.0'我尝试了这个问题的所有这些解决方案。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'}需要将项目与新的 Google Places SDK 同步
查看完整描述

2 回答

?
汪汪一只猫

TA贡献1898条经验 获得超8个赞

当您使用一个信号时,它使用的是旧版本的 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 文件中使用它并将谷歌服务版本更新为 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


查看完整回答
反对 回复 2023-03-31
?
开满天机

TA贡献1786条经验 获得超12个赞

尝试添加对我有用的不同版本,例如 16.0.9 或 firebase 的最新依赖项。



查看完整回答
反对 回复 2023-03-31
  • 2 回答
  • 0 关注
  • 129 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信