Android Kotlin DSL - Unresolved reference: firebaseAppDistribution

Viewed 807

I just migrated my Andoroid project's build system from Groovy to Kotlin DSL. On migrating, I'm unable to solve firebaseAppDistribution { .. } in build.gradle.kts.

The plugin for the FAD has already been apllied and the classpath as well.

plugins {
  id("com.android.application")
  //id("com.google.firebase.appdistribution") //I've tried it here but "Plugin not found"
  kotlin("android")
  kotlin("android.extensions")
  kotlin("kapt")
  id("com.google.gms.google-services")
}


apply(plugin = "com.google.firebase.appdistribution")


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

. .

 productFlavors {
    create("dev") {
     firebaseAppDistribution {
            serviceCredentialsFile = "xxx.json"
            groups = "xx"
          }
    }
 }

. .

**Unresolved reference: firebaseAppDistribution**

How do I fix it ?

1 Answers

You could use :

   import com.google.firebase.appdistribution.gradle.AppDistributionExtension

   productFlavors {
       create("dev") {
           configure<AppDistributionExtension> {
               serviceCredentialsFile = "path/to/serviceAccountKey.json"
               releaseNotes="you release note"
               ...
           }
       }
   }
Related