Ошибка версии в файлах gradle в андроид студии - PullRequest
0 голосов
/ 21 сентября 2018

Это мой файл Gradle.Всякий раз, когда я пытаюсь скомпилировать или даже выполнить чистую сборку, я сталкиваюсь с ошибкой, в которой говорится:

"Исправьте конфликт версий, либо обновив версию плагина google-services (информацию о последней версии можно найти на https://bintray.com/android/android-tools/com.google.gms.google-services/) или обновите версию com.google.android.gms до 16.0.3. "

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "studio.in.prakharshuka.atlastodo"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
//com.google.android.gms to 11.6.0.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.2'
    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'

Пожалуйста, скажите мне, что я делаю неправильно. У меня есть база данных с аутентификацией firebase и база данных, подключенная к моемуприложение.

Ответы [ 2 ]

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

Попробуйте:

Первый шаг

  • если вы используете зависимость от google-services, все версии похожи на эту:

    apply plugin: 'com.android.application'
    
     android {
    compileSdkVersion 28
    defaultConfig {
    applicationId "studio.in.prakharshuka.atlastodo"
    minSdkVersion 22
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
      }
       }
         //com.google.android.gms to 11.6.0.
    
      dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      implementation 'com.google.firebase:firebase-messaging:11.8.0'
      implementation 'com.google.firebase:firebase-config:11.8.0'
      implementation 'com.google.firebase:firebase-auth:16.0.1'
      implementation 'com.google.firebase:firebase-database:16.0.1'
      implementation 'com.google.firebase:firebase-storage:16.0.1'
      implementation 'com.google.firebase:firebase-core:16.0.3'
      implementation 'com.google.firebase:firebase-iid:17.0.1'
      implementation 'com.google.firebase:firebase-messaging:17.3.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'
      }
    
    
     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:3.2.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}


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


task clean(type: Delete) {
delete rootProject.buildDir
 }
0 голосов
/ 21 сентября 2018

Это не должно вызывать ошибку, должно быть только предупреждение.Но тем не менее попробуйте следующее:

1) сохранить обе зависимости firebase в версии 16.0.2.

2) добавить зависимость implementation 'com.google.firebase:firebase-core:16.0.2'.

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