Не удалось найти метод firebaseAppDistribution() для аргументов

Я пытаюсь реализовать распространение приложений Firebase через Gradle, но после добавления этого:

firebaseAppDistribution {
                releaseNotes="Some release notes"
                testers="email@example.com"
            }

и нажмите Sync Now для синхронизации Gradle с проектом сборка завершается ошибкой:

Could not find method firebaseAppDistribution() for arguments [...], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.

Я также добавил это:

apply plugin: 'com.google.firebase.appdistribution'

buildscript {
    repositories {
        google()
    }
    dependencies {
        classpath 'com.google.firebase:firebase-appdistribution-gradle:1.1.0'
    }
}

Кто-нибудь знает, почему сборка может не работать?

Заранее спасибо.

2 ответа

Решение

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

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.appdistribution'

Плагин firebase.appdistribution должен быть чуть ниже плагина android.application

Добавить

classpath 'com.google.firebase:firebase-appdistribution-gradle:1.1.0'

в файле project/build.gradle и

Добавить

apply plugin: 'com.google.firebase.appdistribution'

в файле app/build.gradle под плагином Android

Другие вопросы по тегам