Невозможно разрешить зависимости Firebase и Google Play. - PullRequest
0 голосов
/ 20 декабря 2018

Я пытаюсь подключить свой проект Android к Firebase.Он также работал правильно при запуске.Я не знаю, что случилось внезапно, я получил ряд неразрешенных зависимостей.

Я сделал почти все шаги, которые я нашел в сети.Как отключить автономную работу, Invalidate chache / restart.Даже когда я создаю новый проект, я сталкиваюсь с той же проблемой.Раньше с этим ничего не происходило.

Код моего приложения:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

      }
    }

     allprojects {
       repositories {
        google()
        maven { url "http://jcenter.bintray.com"}
        jcenter()
      }
     }

     task clean(type: Delete) {
        delete rootProject.buildDir
     }

build.gradle для модуля

apply plugin: 'com.android.application'

     android {
       compileSdkVersion 28
       defaultConfig {
        applicationId "com.aabsys.metasensing"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "2.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'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    }

     apply plugin: 'com.google.gms.google-services'

Заранее спасибо. Пожалуйста, найдите изображение

Ответы [ 3 ]

0 голосов
/ 20 декабря 2018

Попробуйте изменить путь к классу

classpath 'com.google.gms:google-services:4.2.0'
0 голосов
/ 21 декабря 2018

Я решил свою проблему, уменьшив версию службы Google до:

classpath 'com.google.gms:google-services:4.0.0'

И удалив

implementation 'com.google.firebase:firebase-core:16.0.1'

0 голосов
/ 20 декабря 2018

Попробуйте добавить в свой код следующую зависимость: -

implementation 'com.google.android.gms:play-services:12.0.1'

Если проблема все еще не решена, попробуйте обновить службы Google play и репозиторий Google. enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...