我有以下app / build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 27
...
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation filetree(include: ['*.jar', '*.aar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.github.IntruderShanky:scatter-piechart:1.0.0'
implementation 'com.etsy.android.grid:library:1.0.5'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'com.google.zxing:core:3.3.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
并遵循project / build.gralde
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我将鼠标悬停在Firebase实现上方时,会收到以下警告
实施’com.google.firebase:firebase-messaging:11.8.0’向我展示
A newer version of com.google.firebase:firebase-messaging than 11.8.0
is available: 17.1.0
和实现“ com.google.firebase:firebase-core:11.8.0”向我展示
A newer version of com.google.firebase:firebase-core than 11.8.0
is available: 16.0.1
然后进行建议,并将实现更新为可用版本,如下所示
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
并同步我的项目.但是该项目向我展示了以下错误
Failed to resolve: play-services-base Open File
Failed to resolve: play-services-tasks Open File
Failed to resolve: play-services-stats Open File
Failed to resolve: play-services-ads-identifier Open File
Failed to resolve: play-services-basement Open File
解决方法:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在jcenter()之前添加google()仓库,并使用最新的google服务插件版本4.0.2
https://bintray.com/android/android-tools/com.google.gms.google-services/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。