Hi I’m new to flutter and firebase and I’M trying to connect my project to firebase. I’m following the buildscript syntax and trying to add firebase plugins to my project using it, I followed
https://firebase.google.com/docs/android/troubleshooting-faq?hl=en&authuser=0&_gl=1*1mugxk1*_ga*MTM1MTI4NTQxNy4xNzAwMjk4NjQ1*_ga_CW55HF8NVT*MTcxNjAyOTExOC4xNy4xLjE3MTYwMjkxMzguNDAuMC4w#add-plugins-using-buildscript-syntax
firebase’s website but when i put all the plugins and id’s it does not recognize them. let me show you my gradle files:
app level:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
id 'com.google.firebase.appdistribution'
id 'com.google.firebase.crashlytics'
id 'com.google.firebase.firebase-perf'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.connectio.connectio"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.connectio.connectio"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 {
implementation platform('com.google.firebase:firebase-bom:33.0.0')
implementation 'com.google.firebase:firebase-analytics'
}
android level:
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
// Add the Maven coordinates and latest version of the plugin
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.google.firebase:firebase-appdistribution-gradle::5.0.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.1'
classpath 'com.google.firebase:perf-plugin:1.4.2'
}
}
/*
plugins {
// ...
// Add the dependency for the Google services Gradle plugin
id 'com.google.gms.google-services' version '4.4.1' apply false
//id 'com.android.application' version '7.2.2' apply false
//id 'com.android.library' version '7.2.2' apply false
//id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
}
*/
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
and I get this error:
Launching libconnectiomain.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.google.firebase:firebase-appdistribution-gradle:.
Required by:
project :
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
Error: Gradle task assembleDebug failed with exit code 1
please help
………………………………..
Selin Uygun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.