android - 添加 ML Kit 后无法解决:com.google.android.gms:play-services:15.0.1
问题描述
看这里请我尝试将 ML Kit 添加到我的应用程序的构建 gradle 中,但它没有完全运行。我想它一定来自我的 build.gradle 文件,但我不知道在哪里。请帮忙?
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
//Firebase libraries
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-ml-vision:16.0.0'
//Other Stuff
implementation 'com.firebase:geofire-android:2.3.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.r0adkll:slidableactivity:2.0.6'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
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-annotations:27.1.1'
implementation 'com.google.android.gms:play-services:15.0.1'
}
下面是 build.gradle(project)。我什至包括了谷歌存储库,但仍然无济于事。请帮忙
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
Google API 发行说明表明对组合库的支持play-services
已于 2018 年 4 月结束:
从 15.0.0 开始,将不再有 play-services 别名目标来拉入所有 Google Play 服务组件。一段时间以来一直建议不要这样做。
您不能再指定对组合 Google Play 服务目标的依赖项,implementation 'com.google.android.gms:play-services:15.0.1'
. 当以前的版本支持这一点时,它会引入所有的 Google Play 库——远远超过你的需要。请参阅设置指南表 1 中的 API 列表,其中仅包括您的应用使用的特定 API。
对Google Maven 存储库的检查确认版本 12.0.1 是组合 play-services 目标的最后一个版本。
推荐阅读
- flutter - Flutter - 收到通知时运行代码,而不点击它
- machine-learning - 使用 keras 在深度学习模型中训练数据形状误差
- reactjs - 如何导出 npm 库源代码以供使用该库的应用程序使用?
- php - 从 php 执行 GhostScript
- javascript - 将对象 x 位置设置为对象 y 位置减去另一个值(JavaScript / CSS)
- css - 防止元素在缩放时调整大小,而不是使用 vh
- node.js - 获取 index.html 文件和错误 304 以获取已发送到 server.js 的请求
- angular - Angular 是个好习惯吗
- html - 导航栏中的 Bootsrap 4 汉堡菜单
- php - EasyAdmin bundle:如何根据角色在表格中显示数据?