Ошибка Gradle при сборке Flutter apk после добавления firebase - PullRequest
0 голосов
/ 01 июня 2018

Я хочу внедрить Firebase Cloud Messaging в свое приложение Flutter, и я начал внедрять часть Android.Я добавил зависимости так же, как в документации Firebase, но теперь я получаю ошибку gradle при сборке моего приложения:

The library com.google.firebase:firebase-iid is being requested by various other libraries at [[16.0.0,16.0.0]], but resolves to 15.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

У меня совсем нет опыта работы с gradle, поэтому я был бы признателен за помощь ^^

Вот приложение / build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.leodr.pguapp"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
}

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

А вот проект build.gradle (при необходимости):

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.0.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

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

Ответы [ 3 ]

0 голосов
/ 30 августа 2018

напишите это внизу app.gradle com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

0 голосов
/ 11 января 2019

привет, у меня была такая же проблема, но я исправил ее, добавив build.gradle, надеюсь и решу ее

dependencies {

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.0.1'
    classpath 'com.android.tools.build:gradle:3.2.1'
}
0 голосов
/ 02 июня 2018

Понизьте версию gms на вашем build.gradle доclasspath 'com.google.gms: google-services: 3.2.1'

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