问题描述
近 48 小时以来,我一直在尝试将 FCM 添加到我的 android 应用程序中.我在 Android Studio 上一直因这两个错误而失败.我已经尝试了此 中的所有解决方案发布.我仍然无法修复它.
I have been tryong to add FCM to my android application for almost 48 hours now. I am keep on failing with these two errors on Android Studio. I have tried all the solutions in this post. Still I couldn't fix it.
我希望将 Firebase 云消息传递集成到我的应用中.所以我做了以下事情.
I want firebase cloud messaging to be integrated in my app. So I did the followings.
- 在 Firebase 控制台中创建了一个应用
- 包含 .json 配置文件
- 添加了 SDK
实现 'com.google.firebase:firebase-messaging:17.0.0'
(在应用级 gradle 中)apply plugin: 'com.google.gms.google-services'
(最后在应用级 gradle 文件中行)类路径 'com.google.gms:google-services:4.0.1'
(在项目级别的gradle中)- 添加了存储库
google()
(在项目级gradle中)
- Created an app in the firebase console
- Included the .json config file
- Added the SDK
implementation 'com.google.firebase:firebase-messaging:17.0.0'
(In the app level gradle)apply plugin: 'com.google.gms.google-services'
(In the app level gradle file last line)classpath 'com.google.gms:google-services:4.0.1'
(In the project level gradle)- Added the repository
google()
(In the project level gradle)
我已经尝试过多次同步,但我不断收到错误
I have tried syncing many times and I keep on getting the error
无法解决:play-services-tasks 打开文件
Failed to resolve: play-services-tasks Open File
无法解决:play-services-basement 打开文件
Failed to resolve: play-services-basement Open File
附带说明,我使用的是 gradle 插件 3.1.3
On a side note, I am using the gradle plugin 3.1.3
classpath 'com.android.tools.build:gradle:3.1.3'
请有人帮我一下.
推荐答案
jcenter()
有时充当某些 Google 依赖项的镜像存储库.在 Gradle 构建过程中,它会在 repositories {...}
块中列出的第一个条目中查找依赖项.因此,如果此存储库损坏或任何依赖项发生不良情况,该过程将失败.
jcenter()
sometimes act as a mirror repository for some Google dependencies. During Gradle building process, it looks for dependencies in the first entry listed in your repositories {...}
block. So if this repository is broken or something bad occurs with any dependency the process will fail.
这里有推荐的仓库列表顺序
Here there is a recommended order for repository list
repositories {
google()
maven {
url 'https://maven.google.com/'
}
jcenter()
}
这篇关于无法解决:play-services-tasks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!