Unable to add Firebase Crashlytics for Gradle version 7.2 - android

Unable to add Firebase Crashlytics dependencies/classpath in Android for Gradle 7.2
Where should I write.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
I successfully mapped Google services as.
classpath 'com.google.gms:google-services:4.3.10'
//to
id "com.google.gms.google-services" version "4.3.10" apply false
Getting following error if I map Crashlytics classpath
Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.firebase.firebase-crashlytics-gradle', version: '2.9.0', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.google.firebase.firebase-crashlytics-gradle:com.google.firebase.firebase-crashlytics-gradle.gradle.plugin:2.9.0')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
MavenRepo
BintrayJCenter
maven(https://jitpack.io)
Project level Gradle
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
id "com.google.gms.google-services" version "4.3.10" apply false
// below line has a problem
id 'com.google.firebase.firebase-crashlytics-gradle' version '2.9.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
}
Gradle-wrapper.properties
#Thu May 12 10:12:33 PKT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "Video Player"
include ':app'
I had searched a lot before posting this question but didn't find something useful.

The documentation is not updated for the new Android project structure yet.
In your project level build.gradle you need to add this:
buildscript {
//other things....
dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
id "com.google.gms.google-services" version "4.3.10" apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Then in your app level build.gradle at the start you need to add the plugin
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.firebase.crashlytics'
}
and then in the same file add the Crashlytics dependencies to the corresponding block:
dependencies {
//... other dependencies
implementation platform('com.google.firebase:firebase-bom:30.1.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
}

Add this inside Root project build.gradle
plugins {
id 'com.google.gms.google-services' version '4.3.10' apply false
id 'com.google.firebase.crashlytics' version '2.9.1' apply false
.... some others classpath
}
And this inside the App Module build.gradle
plugins {
.... some others plugins
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
And finally...
implementation platform('com.google.firebase:firebase-bom:30.3.1')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
So force a crash in your code, something like this
throw RuntimeException("Crashlytics Test")
Now check your Firebase Console
Done!

In your project's build.gradle:
buildscript {
...
ext.crashlytics_version = '2.9.1'
}
plugins {
...
id 'com.google.firebase.crashlytics' version "$crashlytics_version" apply false
}
Then in your app's build.gradle, apply the plugin:
plugins {
...
id 'com.google.firebase.crashlytics'
}

You should use like this
id 'com.google.firebase.crashlytics' version '2.9.2' apply false

Use the Kotlin libraries, even if you're on Java:
...
implementation platform('com.google.firebase:firebase-bom:30.3.1')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
...

Related

how to connect firebase to android studio [duplicate]

I just updated Android Studio and started a new project. But now the project grade file seems different.
Here are the lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now, for example, I need to paste the Firebase lines in the project level Gradle file. Where should I do it?
Here's the Firebase code:
buildscript {
repositories {
google() // Google's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google() // Google's Maven repository
}
}
In all of my previous projects, the Gradle structure was also like that. Now I'm a little confused about what to do.
But now the project grade file seems different.
Yes, starting with the new Bumblebee update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have to add to your build.gradle (Project) file the following lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'com.google.gms.google-services' version '4.3.0' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
In this way, your Firebase services will finally work.
P.S. Not 100% sure if the Firebase Assistant is updated with these new Android Studio changes.
Edit 2022-14-07:
Here is a repo that uses this new structure:
https://github.com/alexmamo/FirestoreCleanArchitectureApp
Edit:
There is nothing changed regarding the way you add dependencies in the build.gradle (Module) file. If for example, you want to add Firestore and Glide, please use:
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:29.0.4")
implementation "com.google.firebase:firebase-firestore"
implementation "com.github.bumptech.glide:glide:4.12.0"
}
Edit2:
With the new updates, you don't need to worry about adding any lines under the repositories { }. That was a requirement in the previous versions.
I've had the same problem just add in the gradle.build project
id 'com.google.gms.google-services' version '4.3.0' apply false
and then add in gradle.build module
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:30.4.0")
implementation "com.google.firebase:firebase-firestore"
}
You will find your classpath from https://console.firebase.google.com/
You will find something like this in the firebase(if you already got your classpath then you can ignore this section)
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
...
// Add the dependency for the Google services Gradle plugin
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
...
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
just copy the classpath
1)In build.gradle(project)
before plugins make these changes-->
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2)In build.gradle(module) add these lines in pulgins and dependencies section
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
}

Android Studio build.gradle Missing Elements [duplicate]

I just updated Android Studio and started a new project. But now the project grade file seems different.
Here are the lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now, for example, I need to paste the Firebase lines in the project level Gradle file. Where should I do it?
Here's the Firebase code:
buildscript {
repositories {
google() // Google's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google() // Google's Maven repository
}
}
In all of my previous projects, the Gradle structure was also like that. Now I'm a little confused about what to do.
But now the project grade file seems different.
Yes, starting with the new Bumblebee update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have to add to your build.gradle (Project) file the following lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'com.google.gms.google-services' version '4.3.0' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
In this way, your Firebase services will finally work.
P.S. Not 100% sure if the Firebase Assistant is updated with these new Android Studio changes.
Edit 2022-14-07:
Here is a repo that uses this new structure:
https://github.com/alexmamo/FirestoreCleanArchitectureApp
Edit:
There is nothing changed regarding the way you add dependencies in the build.gradle (Module) file. If for example, you want to add Firestore and Glide, please use:
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:29.0.4")
implementation "com.google.firebase:firebase-firestore"
implementation "com.github.bumptech.glide:glide:4.12.0"
}
Edit2:
With the new updates, you don't need to worry about adding any lines under the repositories { }. That was a requirement in the previous versions.
I've had the same problem just add in the gradle.build project
id 'com.google.gms.google-services' version '4.3.0' apply false
and then add in gradle.build module
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:30.4.0")
implementation "com.google.firebase:firebase-firestore"
}
You will find your classpath from https://console.firebase.google.com/
You will find something like this in the firebase(if you already got your classpath then you can ignore this section)
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
...
// Add the dependency for the Google services Gradle plugin
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
...
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
just copy the classpath
1)In build.gradle(project)
before plugins make these changes-->
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2)In build.gradle(module) add these lines in pulgins and dependencies section
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
}

Stuck to firebase set up step 3 [duplicate]

I just updated Android Studio and started a new project. But now the project grade file seems different.
Here are the lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now, for example, I need to paste the Firebase lines in the project level Gradle file. Where should I do it?
Here's the Firebase code:
buildscript {
repositories {
google() // Google's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google() // Google's Maven repository
}
}
In all of my previous projects, the Gradle structure was also like that. Now I'm a little confused about what to do.
But now the project grade file seems different.
Yes, starting with the new Bumblebee update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have to add to your build.gradle (Project) file the following lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'com.google.gms.google-services' version '4.3.0' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
In this way, your Firebase services will finally work.
P.S. Not 100% sure if the Firebase Assistant is updated with these new Android Studio changes.
Edit 2022-14-07:
Here is a repo that uses this new structure:
https://github.com/alexmamo/FirestoreCleanArchitectureApp
Edit:
There is nothing changed regarding the way you add dependencies in the build.gradle (Module) file. If for example, you want to add Firestore and Glide, please use:
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:29.0.4")
implementation "com.google.firebase:firebase-firestore"
implementation "com.github.bumptech.glide:glide:4.12.0"
}
Edit2:
With the new updates, you don't need to worry about adding any lines under the repositories { }. That was a requirement in the previous versions.
I've had the same problem just add in the gradle.build project
id 'com.google.gms.google-services' version '4.3.0' apply false
and then add in gradle.build module
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:30.4.0")
implementation "com.google.firebase:firebase-firestore"
}
You will find your classpath from https://console.firebase.google.com/
You will find something like this in the firebase(if you already got your classpath then you can ignore this section)
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
...
// Add the dependency for the Google services Gradle plugin
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
...
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
just copy the classpath
1)In build.gradle(project)
before plugins make these changes-->
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2)In build.gradle(module) add these lines in pulgins and dependencies section
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
}

Build Gradle looks different. How to I install Firebase? [duplicate]

I just updated Android Studio and started a new project. But now the project grade file seems different.
Here are the lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now, for example, I need to paste the Firebase lines in the project level Gradle file. Where should I do it?
Here's the Firebase code:
buildscript {
repositories {
google() // Google's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google() // Google's Maven repository
}
}
In all of my previous projects, the Gradle structure was also like that. Now I'm a little confused about what to do.
But now the project grade file seems different.
Yes, starting with the new Bumblebee update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have to add to your build.gradle (Project) file the following lines:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'com.google.gms.google-services' version '4.3.0' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
In this way, your Firebase services will finally work.
P.S. Not 100% sure if the Firebase Assistant is updated with these new Android Studio changes.
Edit 2022-14-07:
Here is a repo that uses this new structure:
https://github.com/alexmamo/FirestoreCleanArchitectureApp
Edit:
There is nothing changed regarding the way you add dependencies in the build.gradle (Module) file. If for example, you want to add Firestore and Glide, please use:
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:29.0.4")
implementation "com.google.firebase:firebase-firestore"
implementation "com.github.bumptech.glide:glide:4.12.0"
}
Edit2:
With the new updates, you don't need to worry about adding any lines under the repositories { }. That was a requirement in the previous versions.
I've had the same problem just add in the gradle.build project
id 'com.google.gms.google-services' version '4.3.0' apply false
and then add in gradle.build module
dependencies {
//Regular dependecies
implementation platform("com.google.firebase:firebase-bom:30.4.0")
implementation "com.google.firebase:firebase-firestore"
}
You will find your classpath from https://console.firebase.google.com/
You will find something like this in the firebase(if you already got your classpath then you can ignore this section)
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
...
// Add the dependency for the Google services Gradle plugin
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
...
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
just copy the classpath
1)In build.gradle(project)
before plugins make these changes-->
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2)In build.gradle(module) add these lines in pulgins and dependencies section
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
}

How can we add Admob and Firebase crashlytics to Android studio bumble bee Build.Gradle file

How can we add Admob and Firebase crashlytics to Android studio bumble bee
earlier the build.gradle: was some thing like this
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// Add the following line:
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
// Add the Crashlytics Gradle plugin
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
However now the changes look like these
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried adding these lines
// Add the following line:
id 'com.google.gms:google-services' version '4.3.10' apply false
// Google Services plugin
// Add the Crashlytics Gradle plugin
id 'com.google.firebase:firebase-crashlytics-gradle' version '2.8.1' apply false
But it error is
Caused by: org.gradle.plugin.internal.InvalidPluginIdException: plugin id 'com.google.gms:google-services' is invalid: Plugin id contains invalid char ':' (only ASCII alphanumeric characters, '.', '_' and '-' characters are valid)
at org.gradle.plugin.use.internal.DefaultPluginId.validate(DefaultPluginId.java:65)
at org.gradle.plugin.use.internal.DefaultPluginId.of(DefaultPluginId.java:48)
at org.gradle.plugin.use.internal.PluginRequestCollector$PluginDependencySpecImpl.<init>(PluginRequestCollector.java:139)
at org.gradle.plugin.use.internal.PluginRequestCollector$PluginDependencySpecImpl.<init>(PluginRequestCollector.java:129)
at org.gradle.plugin.use.internal.PluginRequestCollector$PluginDependenciesSpecImpl.id(PluginRequestCollector.java:116)
Add com.google.gms.google-services and com.google.firebase.crashlytics like this:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'com.google.gms.google-services' version '4.3.10' apply false // Google Services plugin
// Crashlytics Gradle plugin
id 'com.google.firebase.crashlytics' version '2.8.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add buildscript above plugins
buildscript {
dependencies {
// Add our classpath
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In <project>/build.gradle:
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules`.
And in <project>/<app-module>/build.gradle:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'//this one
}
And this in dependencies:
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics-ktx'

Categories

Resources