Closed russellwheatley closed 6 months ago
thx @russellwheatley was going to do it, but noticed u did it already.
Could you post your gradle.settings
file which allowed the google-services
line to be duplicated?
@skela - I have tested the settings.gradle
, flutterfire configure
updated it when this line was not present:
id "com.google.gms.google-services" version "4.3.15" apply false
It also recognised when the above line was present and did not write. I also tested with different version
id "com.google.gms.google-services" version "4.4.0" apply false
and it still correctly did not write when it was present in settings.gradle
.
I'm going to need a copy of your settings.gradle
file that duplicates the above mentioned when you run flutterfire configure
.
In my case, I have duplicates in the android/app/build.gradle
file.
I am using flavors and running this script calling the flutterfire configure
command 6 times (for Debug-prod
, Release-prod
, Profile-prod
, Debug-dev
, Release-dev
, Profile-dev
):
and after that, in my android/app/build.gradle
file I have 5 times of these lines:
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
and 1 of these:
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
The result android/settings.gradle
file looks correct:
@russellwheatley sorry, the duplications seem to happen in the app/build.gradle file.
Steps to reproduce:
flutter create -t plugin --platforms ios,android --org com.whatever something
cd something
flutter pub add firebase_core
flutter pub add firebase_analytics
cd example
~/.pub-cache/bin/flutterfire configure
example/android/app/build.gradle now has 1 google services line in plugins.
Run the configure again:
~/.pub-cache/bin/flutterfire configure
It now has 2.
Run it again and u get 3 etc.
Contents of the example/android/settings.gradle
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
// END: FlutterFire Configuration
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
include ":app"
Contents of example/android/app/build.gradle
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
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.space.yeehaw_example"
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.space.yeehaw_example"
// 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 flutter.minSdkVersion
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 {}
This happens for me too.
please re-open: Missing google_app_id. Firebase Analytics
settings.gradle is not changed when flutterfire reconfigure o flutterfire configure only the build.gradle is changed
Is there an existing issue for this?
CLI Version
flutterfire_cli 0.3.0-dev.20
Firebase Tools version
latest
Flutter Doctor Output
N/A
Description
Writes google service line twice (i.e. if one is present, it will still write a second time).
Steps to reproduce
N/A
Expected behavior
Not to write again if present
Screenshots
No response
Additional context and comments
No response