java - 添加 firebase 与 google play 服务冲突
问题描述
自从将 Firebase 添加到我的应用程序以便我可以通过 appcenter 向用户发送推送通知以来,我遇到了许多问题。
我目前遇到两个库之间可能的合并问题。
Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-basement is being
requested by various other libraries at [[15.0.1,15.0.1]], but
resolves to 16.0.1. Disable the plugin and check your dependencies
tree using ./gradlew :app:dependencies.
正如你在这里看到的,我对 play-services-basement 没有任何特定的依赖项......
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'io.realm:realm-gradle-plugin:5.3.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
realm {
syncEnabled = true
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.xxxxsoftware.xxxx.xxxx"
minSdkVersion 16
targetSdkVersion 28
versionCode 36
versionName "2.8.17"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true
}
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 fileTree(include: ['*.jar'], dir: 'libs')
def appCenterSdkVersion = '1.9.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-push:${appCenterSdkVersion}"
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'io.realm:android-adapters:3.0.0'
implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'
implementation 'com.journeyapps:zxing-android-embedded:3.1.0@aar'
implementation 'com.github.pwittchen:reactivenetwork-rx2:2.0.0'
}
我已经运行了命令 ./gradlew :app:dependencies 并打印出:
* What went wrong:
Project 'app' not found in root project 'ChimePassportAndroid'.
解决方案
为了使用 Firebase 消息传递,您需要在build.gradle
文件中添加相应的依赖项,如下所示:
implementation 'com.google.firebase:firebase-messaging:17.3.4'
你的问题将得到解决。
推荐阅读
- javascript - 在递归循环中将值推送到全局数组
- android - How to get an instance of an activity from a fragment in Android?
- r - Can I add a gif on top of another gif in R?
- php - Match 2 columns from the same table to the same single column in another table (total of 3 joins)
- sql - SQL subqueries - the highest number of courses
- angular - Angular HTMLElement 无法从服务中工作,但没有它就可以
- java - 如何在不传递用户名和密码的情况下通过java连接到unix
- sql - 想要从 ORACLE SQL 中的 2 个单独列中为一个团队提供平均点
- r - R blur_left_join 与时间
- html - 有没有一种方法可以堆叠元素而不考虑堆叠顺序和上下文?