Hi,
can I see your file: platforms\android\app\build.gradle
I want to know where to put this code:
- // Import the Firebase BoM
- implementation platform('com.google.firebase:firebase-bom:26.6.0')
- // Add the dependency for the Firebase SDK for Google Analytics
- // When using the BoM, don't specify versions in Firebase dependencies
- implementation 'com.google.firebase:firebase-analytics'
- // Add the dependencies for any other desired Firebase products
- // https://firebase.google.com/docs/android/setup#available-libraries
because I find two code segment:
1. Start at line 355:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "com.android.support:support-v4:27.1.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
implementation "com.android.support:support-v4:27.+"
implementation "com.android.support:support-v4:26.+"
implementation "com.android.support:support-v4:28.+"
implementation "com.android.support:appcompat-v7:28.+"
implementation "com.android.support:support-v13:27.+"
implementation "me.leolin:ShortcutBadger:1.1.17@aar"
implementation "com.google.firebase:firebase-messaging:17.5.+"
// SUB-PROJECT DEPENDENCIES END
}
2. start at line: 54
dependencies {
apply from: '../CordovaLib/cordova.gradle'
classpath 'com.android.tools.build:gradle:4.0.0'
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
if(cdvHelpers.getConfigPreference('GradlePluginGoogleServicesEnabled', 'false').toBoolean()) {
String defaultGradlePluginGoogleServicesVersion = '4.2.0'
/**
* Fetches the user's defined Google Services Plugin Version from config.
xml.
* If the version is not set or invalid, it will default to the ${defaultGradlePluginGoogleServicesVersion}
*/
String gradlePluginGoogleServicesVersion = cdvHelpers.getConfigPreference('GradlePluginGoogleServicesVersion', defaultGradlePluginGoogleServicesVersion)
if(!cdvHelpers.isVersionValid(gradlePluginGoogleServicesVersion)) {
println("The defined Google Services plugin version (${gradlePluginGoogleServicesVersion}) does not appear to be a valid version. Falling back to version: ${defaultGradlePluginGoogleServicesVersion}.")
gradlePluginGoogleServicesVersion = defaultGradlePluginGoogleServicesVersion
}
// Create the Google Services classpath and set it.
String gradlePluginGoogleServicesClassPath = "com.google.gms:google-services:${gradlePluginGoogleServicesVersion}"
println "Adding classpath: ${gradlePluginGoogleServicesClassPath}"
classpath gradlePluginGoogleServicesClassPath
}
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation 'com.google.firebase:firebase-analytics'
}
And I dont know which one to modify as firebase suggest