Не удалось собрать проект после добавления плагина firestore, androidx libs и google-services до последней версии (4.1.0) - PullRequest
0 голосов
/ 26 ноября 2018

Я хочу работать с firebase (firestore) с помощью библиотек androidx / jetpack (навигация, constrintlayout и т. Д.).но при добавлении плагина google services в корневой build.gradle и библиотек firebase, таких как auth и firestore, в модуле приложения build.gradle, сборка завершается неудачей.

1) корневая сборка проекта.gradle

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

buildscript {
    ext.kotlin_version = '1.3.10'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0-alpha04'
        classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

(2) модуля приложения проекта build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'androidx.navigation.safeargs'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "org.bitbucket.marlonlom.elcorral"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
    implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07'
    implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07'
    implementation 'com.google.android.material:material:1.1.0-alpha01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.synnapps:carouselview:0.1.5'
    implementation "com.google.firebase:firebase-firestore:17.1.3"
    implementation "com.google.firebase:firebase-auth:16.0.5"
    implementation "com.google.firebase:firebase-core:16.0.5"
    implementation "com.google.android.gms:play-services-auth:16.0.1"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

}

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

(3) корневого проекта build.gradle

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-api:[16.0.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[16.0.4].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.firebase:firebase-analytics-impl:[16.2.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-api:[16.0.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[16.0.4].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.firebase:firebase-analytics-impl:[16.2.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-api:[16.0.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[16.0.4].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-analytics-impl:[16.2.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-api:[16.0.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[16.0.4].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.firebase:firebase-analytics-impl:[16.2.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-api:[16.0.3].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[16.0.4].
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-analytics-impl:[16.2.3].
Show Details
Affected Modules: app

Любая помощь с этим?

С уважением,

Ответы [ 2 ]

0 голосов
/ 29 ноября 2018

Прежде всего, спасибо за комментарии: @ peter-haddad и @ achraf-amil

В конце концов, я сделал это для исправления файлов build.gradle, которые я упоминал ранее, с точки зрения просмотра версийиз библиотек, которые я использовал:

(1) В корне build.gradle :

...
dependencies{
  ...
  classpath 'com.android.tools.build:gradle:3.4.0-alpha05'
  ...
  //noinspection GradleDependency
  classpath 'com.google.gms:google-services:4.0.2'
  ...
}

дополнительно я перечислил версии зависимостей здесь.

...
ext {
    kotlin_version = '1.3.10'
    /* androidx related dependencies */
    androidx_appcompat_version = '1.0.2'
    androidx_core_ktx_version = '1.0.1'
    androidx_constraintlayout_version = '2.0.0-alpha2'
    androidx_legacy_support_v4_version = '1.0.0'
    android_arch_navigation_fragment_ktx_version = '1.0.0-alpha07'
    android_arch_navigation_ui_ktx_version = '1.0.0-alpha07'
    google_material_version = '1.1.0-alpha01'
    /* firebase dependencies */
    firebase_firestore_version = '17.1.1'
    firebase_auth_version = '16.0.4'
    firebase_storage_version = '16.0.3'
    firebase_core_version = '16.0.4'
    play_services_auth_version = '16.0.1'
    /* other dependencies */
    synnapps_carouselview_version = '0.1.5'
    /* Testing dependencies versions*/
    junit_version = '4.12'
    androidx_test_runner_version = '1.1.0'
    androidx_test_espresso_core_version = '3.1.0'
}

(2) В модуле приложения build.gradle я применил версии как переменные в блоке зависимостей:

...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlin_version"
    implementation "androidx.core:core-ktx:$rootProject.androidx_core_ktx_version"
    implementation "androidx.constraintlayout:constraintlayout:$rootProject.androidx_constraintlayout_version"
    implementation "android.arch.navigation:navigation-fragment-ktx:$rootProject.android_arch_navigation_fragment_ktx_version"
    implementation "android.arch.navigation:navigation-ui-ktx:$rootProject.android_arch_navigation_ui_ktx_version"
    implementation "com.google.android.material:material:$rootProject.google_material_version"
    implementation "androidx.legacy:legacy-support-v4:$rootProject.androidx_legacy_support_v4_version"
    implementation "com.synnapps:carouselview:$rootProject.synnapps_carouselview_version"
    implementation "com.google.android.gms:play-services-auth:$rootProject.play_services_auth_version"

    //noinspection GradleDependency
    implementation "com.google.firebase:firebase-firestore:$rootProject.firebase_firestore_version"
    //noinspection GradleDependency
    implementation "com.google.firebase:firebase-auth:$rootProject.firebase_auth_version"
    //noinspection GradleDependency
    implementation "com.google.firebase:firebase-storage:$rootProject.firebase_storage_version"
    //noinspection GradleDependency
    implementation "com.google.firebase:firebase-core:$rootProject.firebase_core_version"

    testImplementation "junit:junit:$rootProject.junit_version"
    androidTestImplementation "androidx.test:runner:$rootProject.androidx_test_runner_version"
    androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.androidx_test_espresso_core_version"

}

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

помогла текстовая часть // noinspection GradleDependencyв проверке различных версий библиотеки и версий библиотеки Google Play.

IDK, если это рекомендуемый способ, но он работал (пока).

С уважением,

0 голосов
/ 29 ноября 2018

Была такая же проблема, попробуйте предыдущие версии.Последняя версия, которая работает для меня (на сегодняшний день): 17.1.0

https://mvnrepository.com/artifact/com.google.firebase/firebase-firestore

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