I am trying to integrate firebase crashalytics to existing app which is android appcompat. I added dependencies as instructed by firebase as below.
buildscript {
// ...
repositories {
// ...
// Add Google's Maven repository (if it's not there already).
google()
}
dependencies {
// ..
// Add the Google Services Gradle plugin (if it's not there already).
classpath 'com.google.gms:google-services:4.3.3'
// Add the Firebase Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}
}
added below plugins in build.gradle
apply plugin: 'com.android.application'
// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'
// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
added dependency as below
dependencies {
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.0.1'
// Recommended: Add the Google Analytics SDK.
implementation 'com.google.firebase:firebase-analytics:17.4.3'
}
but am getting error manifest merger failed even i added tools:replace="android:appComponentFactory"
Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] because of aadding firebase crashalytics
1.Adding the following lines in Gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
at the bottom of the file android/Gradle.properties
If 1st one is not working then try this.
2.Replace the line
implementation
"com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
with
implementation 'androidx.appcompat:appcompat:1.0.0'
in android/app/build.gradle
I hope it helps).
Related
I updated my Android project to 7.0.2 and this changed the
classpath 'com.google.gms:google-services:4.3.8' to
classpath 'com.google.gms:google-services:4.3.9'.
After the update I started getting an error that FirebaseApp is not initialized or build Gradle does not include gms: google services.
I tried to add
FirebaseApp.initializeApp(mycontext);
method also in my Firebase token Async Task where the error is triggering, but this does not help.
Can someone suggest how to fix it?
In your app-level Gradle file add the 'apply plugin' line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.android.application'
dependencies {
// ...
implementation 'com.google.firebase:firebase-bom'
// If getting a "Could not find" error? Make sure you have the latest Google
// Repository in the Android SDK manager
}
//ADD THIS LINE AT BOTTOM
apply plugin: 'com.google.gms.google-services'
or you can add plugin like this:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
Now, sync both the gradle files
I followed the tutorial exactly (https://firebase.google.com/docs/crashlytics/get-started?authuser=1&platform=android#android) and still can't see my app on firebase Crashlytics. here's my configuration:
in root build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'io.fabric.tools:gradle:1.31.0'
}
in app build.gradle
...
apply plugin: "io.fabric"
...
//Firebase
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-config:18.0.0'
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
in Application
Fabric.with(this, Crashlytics());
I'm building and running the app on debug but nothing is happening, in the logs I see
I/CrashlyticsInitProvider: CrashlyticsInitProvider skipping initialization
I/CrashlyticsCore: Initializing Crashlytics Core 2.7.0.33
what could I be missing?
For anyone who is facing a similar issue, I have looked for many hours and eventually checked the merged manifest and figured there is a 3rd party library that was actually setting up their own Crashlytics config which overrides mine. So maybe look into that.
I eventually added this to my manifest:
<meta-data
tools:node="remove"
android:name="io.fabric.ApiKey"/>
Refer to the Firebase Crashlytics Docs.
Step 1: Add this code in your project level build.gradle file
buildscript {
repositories {
// Add the following repositories:
google() // Google's Maven repository
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
// ...
// Check for v3.1.2 or higher
classpath 'com.google.gms:google-services:4.3.0' // Google Services plugin
// Add dependency
classpath 'io.fabric.tools:gradle:1.31.0' // Crashlytics plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
Step 2 : Add this code in your app-level build.gradle file
apply plugin: 'io.fabric'
dependencies {
// ...
// Check for v11.4.2 or higher
implementation 'com.google.firebase:firebase-core:17.0.1'
// (Recommended) Add Analytics
implementation 'com.google.firebase:firebase-analytics:17.0.1'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
Make sure you have added google-services.json and running your app in physical device or emulator having google play services.
credit goes to firebase for creating such a helpful docs.
This is Zubair from Fabric/Firebase. Could you try to make individual build and run event on a brand new simulator (where they've not installed/ran this app before). If issue persist, reach out to us AT "support#fabric.io" and include app name/bundle id and firebase project id in the email.
I'm trying to add Firebase to my android app builded with ionic, the firebase's documentation https://firebase.google.com/docs/android/setup says to add this line on my root-level build.gradle.
Here's my Project-level build.gradle (/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.0.1'
}
}
App-level build.gradle (//build.gradle):
dependencies {
// Add this line
implementation 'com.google.firebase:firebase-core:16.0.1'
}
...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
You can find both gradle files in platforms folder,
Project-level build.gradle (/build.gradle): At platforms/android/build.gradle
App-level build.gradle (//build.gradle): At platforms/android/app/build.gradle
How to this i am new on Android Studio.
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
As reported here:
You will need to update the version of the latter dependency to 15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2...
Then update your google play services plugin to 3.3.0
classpath 'com.google.gms:google-services:3.3.0'
and update the dependencies to 15.0.2.
Resolve this issue with me - If You are choosing Firestore Database then do this:
first We will add updated these things in Gradle :
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
after this update :
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.0'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Then Rebuild or Sunc Now , issue will be resolve.
if You are working on RealTime Database then do this thing :-
Set Dependency :
implementation 'com.google.firebase:firebase-database:15.0.0'
and remove above FireStore Dependency.
This will sure resolve your issue ... If you like then vote for me
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
This works for me. By adding the latest version, i.e 4.0.1
How to fix "Could not find com.google.gms:google-services3.0.o " Even after adding json file andgoogle-services.json file applying plugin for it
This is where i applied plugin for google services
[Classpath dependencies][3]
add this in your project module gradle
classpath 'com.google.gms:google-services:3.0.0'
add dependencies
compile 'com.google.android.gms:play-services-auth:10.2.0'
}
apply plugin: 'com.google.gms.google-services'