Не удалось разрешить зависимость для 'com.google.firebase: firebase-auth: 16.0.3' - PullRequest
0 голосов
/ 12 сентября 2018

Я пытаюсь добавить аутентификацию firebase в свой проект.Я получаю следующие ошибки при синхронизации build.gradle:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.3.
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.3.
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.3.
Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.3.
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.3.

Мой файл градала уровня приложения находится ниже:

  apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.example.muzammil.maptestingproject"
            minSdkVersion 15
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        productFlavors {
        }
    }

    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
        implementation 'com.google.android.gms:play-services-vision:15.0.2'
        implementation 'com.google.android.gms:play-services-location:15.0.1'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'


        implementation 'com.google.firebase:firebase-core:16.0.3'
        implementation 'com.google.firebase:firebase-database:16.0.1'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        implementation 'com.google.firebase:firebase-auth:16.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'
    }
    apply plugin: 'com.google.gms.google-services'

Файл градиента уровня проекта:

 buildscript {

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

    allprojects {
        repositories {
            google()
            jcenter()
 maven { url 'https://jitpack.io' }
        }
    }

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

Ответы [ 3 ]

0 голосов
/ 12 сентября 2018

жалуется на отсутствие зависимостей для debugUnitTest, в то время как у вас нет debug типа сборки, указанного на уровне вашего модуля build.gradle. это должно выглядеть примерно так, например:

buildTypes {
    debug {
        applicationIdSuffix '.debug'
        // signingConfig signingConfigs.debug
        minifyEnabled false
        debuggable true
        jniDebuggable true
        zipAlignEnabled true
        renderscriptDebuggable true
        pseudoLocalesEnabled false
        shrinkResources false
    }

также рассмотрите возможность добавления androidTestImplementation "com.android.support.test:rules:1.0.2" в качестве зависимости ... и, возможно, добавьте testBuildType "debug" к defaultConfig.

0 голосов
/ 12 сентября 2018

Поскольку обычный способ не работает, и при условии, что вы используете Android Studio, вы можете попробовать использовать способ с графическим интерфейсом:

  1. Очистить проект
  2. Перестроить проект
  3. Под Tools выберите Firebase
  4. Аутентификация
  5. Аутентификация по электронной почте и паролю
  6. Подключение к Firebase
  7. Добавление зависимостей
  8. Проверьте свой статус авторизации, как описано
0 голосов
/ 12 сентября 2018

В project level gradle файле попробуйте обновить плагин google-services до последней версии:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.1.0' // update version
    }
}
...