Спасибо за добавление ссылки в блог версий SDK! Очень полезно.

сь реализовать Firebase в моем проекте.

Файл Gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.ghaleh.myapplication"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
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.google.firebase:firebase-messaging:15.0.2'
}
apply plugin: 'com.google.gms.google-services'

И я получаю эту ошибку:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.1.0, 15.0.2, 15.0.1, 15.0.0. Examples include com.google.firebase:firebase-iid:15.1.0 and com.google.android.gms:play-services-measurement-base:15.0.2

Согласно сРепозиторий Google Maven последняя версияfirebase-messaging 15.0.2 и я получаю сообщение об ошибкеfirebase-iid:15.1.0 Поэтому я не могу обновитьfirebase-messaging к более высокой версии или реализоватьfirebase-iid:15.1.0 чтобы соответствовать версиям.

Я уже пробовал другие решения, рекомендуемые здесь:1, 2, 3 но ни один из них не был полезен.

Я также попробовал это (однако это не кажется правильным решением):

implementation ('com.google.firebase:firebase-messaging:15.0.2') {
    exclude group: "com.google.android.gms"
}

и я получаю эту ошибку:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForBazaarDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Заранее спасибо.

Ответы на вопрос(1)

Ваш ответ на вопрос