I have implemented Firebase plugin with ionic 3 app. It is working fine. Could you tell me how can I use Crashlytics with this plugin? According to the doc it seems for the native apps. So how can we do it with Ionic 3?
There is a plugin cordova-fabric-plugin which we can use with ionic apps. But it seems we don't need it anymore since this note on the native apps doc: Any guidance please?
Note: If you're upgrading from Fabric Crashlytics, remove the Fabric
API key from your AndroidManifest.xml. Delete the key's meta-data tag,
which should have io.fabric.ApiKey and the API key.
In theory you should setup the FabricPlugin just as described. (the versions required of the firebase are lower than the once included)
To setup on ionic I recommend to read the following issue: https://github.com/sarriaroman/FabricPlugin/issues/70
Short Version: Create then a custom error handler
{provide: ErrorHandler, useClass: FabricErrorHandler},
and then your custom Error Handler
import {Injectable} from "#angular/core";
import {IonicErrorHandler } from 'ionic-angular';
import * as stacktrace from 'stacktrace-js';
#Injectable()
export class FabricErrorHandler extends IonicErrorHandler {
constructor (public analytics: Analytics) {
super();
}
handleError(error) {
window.fabric.Crashlytics.addLog('crash triggered');
stacktrace.get().then(
trace => window.fabric.Crashlytics.endNonFatalCrash(error.message, trace)
);
super.handleError(error);
}
}
Refer this link
https://fabric.io/kits/android/crashlytics/features
Crashlytics with Ionic 3 app
First off, follow what they say… installing the IDE plugin, etc.
Now. Ionic uses gradle for its building. You would expect the install to work right away, but it wont. Ionic/Cordova overwrites the build.gradle definitions in the dependencies section.
Anyway, first off open build.gradle, and in buildscript > repositories, if its not already in there, add
jcenter() maven { url 'https://maven.fabric.io/public' }
Next, there are 3 dependencies for each gradle version. if you know what version you are running, great. otherwise add the following to all of them.
classpath 'io.fabric.tools:gradle:1.+'
Now what we need to do is extend gradle’s build.
Create a file in your android/ios directory called build-extras.gradle.
Inside this, we need to define the repositories.
apply plugin: 'io.fabric' repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } dependencies { // Crashlytics Kit compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') { transitive = true } }
Now, when you run or build the app, it should work, although Fabric.io 79 won’t recognize your app.
We will need to install a cordova plugin,
The one I use is:
https://www.npmjs.com/package/cordova-fabric-plugin 946
After this is installed, add a force crash and rebuild & run your app.
If it is still not working, make sure you do not have any ad-blocking software installed. Even if you don’t but you have in the past, reinstall it and make sure all settings are reset (I.E AdAway edits your hosts files, uninstalling it does not reset them, you need to reset them then you can uninstall them).
Hope this has helped anyone else who had issues setting it up.
EDIT
Currently Crashlytics does not support custom stacktraces. All crashes will come from the Crashlytics/Fabric.io plugin. You have to use the logs to specify the error.
Fabric does not support any non-native platforms except for Unity at this time. However, as #wodka mentioned, there are community workarounds.
Related
Google sign in and phone authentication were working fine in debug and release mode. But after publishing the app in play store, Google sign in produce the following error:
com.google.android.gms.common.api.b 10
Any suggestion is welcome. Thanks.
Google sign in and phone authentication were working fine in debug and release mode.
If you are absolutely sure about this, and that they debug and release keys were added to Firebase. Then the situation you are facing now can be explained by using a different key for your app store.
If you have opted in of google automatically manage signing, then it will have probably signed your app with a different signature than the one you currently have added to firebase console.
Log into your developer console, find the key being used to sign your app, and add that to Firebase, along with the existing keys.
This should\can be solved without having to publish a new release.
The solution is that given by Huthaifa Muayyad. I did what he said and it work.
Thanks.
Try by adding plugin and classpath to the app/build.gradle and android/build.gradle respectively. For reference, I am adding code below.
1)app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' //add this line
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2)android/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3' //add this line
}
So I am getting this [see Image] as a stacktrace after integrating react-native-firebase and I am able to understand it. Message is correct "undefined is not an object". But Line Numbers are missing. This is no file name.
If there is any way I can upload react native bundle to firebase to make it more understandable.
Already read
React Native Firebase Crashlytics Deobfuscation
Can't do this for every crash.
If the functionality is not available on firebase please comment. If the integration was wrong please let me know.
I am using these versions
"#react-native-firebase/app": "^12.0.0",
"#react-native-firebase/crashlytics": "^12.0.0".
And
firebaseCrashlytics {
mappingFileUploadEnabled true
}
is enabled for release flavour.
Checking these issues on release build.
So i installed firebase with adding the "google-services.json" in the App_Resources/Android folder.
After that i used the cli for the cmd: "tns plugin add #nativescript/firebase".
And it was successfull.
But if i try to use "firebase.firestore()" i get the message that firestore is unknown.
Yes i have ticked yes in the installation as it asked me if i want firestore.
So it should be useful but it is not.
I deleted the "firebase.nativescript.json" and run the 'npm run config' command in the android folder but it didnt help.
Then I uninstalled the plugin with "tns plugin remove #nativescript/firebase" and re-installed it.
Nothing works. Here is my fire in #nativescript:
Is there a Solution?
You should be able to import firestore directly from #nativescript/firebase and access its properties that way
import { firestore } from '#nativescript/firebase';
// firebase.firestore().collection('user') becomes the following line
firestore.collection('user')
Unity editor version: 2019.3.15f1
Firebase Unity SDK version: firebase_unity_sdk_6.15.2
Additional SDKs im using: Unity IAP, Gamesparks, Ironsource, Facebook, Appsflyer, GameAnalytics
Platform im using the Unity editor on: Windows
Platform im targeting: Android
Scripting Runtime: IL2CPP
Problem
I am getting data on firebase analytics, but I cannot get crashlytics to report anything. Im stuck on this...
Steps to reproduce:
Add the firebase analytics and crashlytics sdks.
Add the google-services.json GoogleService-Info.plist files somewhere in assets folder
Add this code to initialise the firebase
// Use this for initialization
void Start ()
{
// Initialize Firebase
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
// Create and hold a reference to your FirebaseApp,
// where app is a Firebase.FirebaseApp property of your application class.
// Crashlytics will use the DefaultInstance, as well;
// this ensures that Crashlytics is initialized.
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
// Set a flag here for indicating that your project is ready to use Firebase.
VisualDebugger.SetText("crashlytics initialised");
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}",dependencyStatus));
VisualDebugger.SetText("crashlytics NOT initialised: " + dependencyStatus);
// Firebase Unity SDK is not safe to use here.
}
});
Invoke("IsCrashEnabled", 5f);
}
void IsCrashEnabled()
{
VisualDebugger.AddLine("IsCrashlyticsCollectionEnabled: "+Firebase.Crashlytics.Crashlytics.IsCrashlyticsCollectionEnabled);
}
In order to get the app to run with the facebook sdk installed Ive added these two lines to proguard-user.txt
-keep public class com.facebook.**{public *; }
-keep public class com.facebook.internal.**{ public *; }
and commented out the following lines from mainTemplate.gradle
//implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
//implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
//implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
When I run the app, firebase is initialised successfully. Also Firebase.Crashlytics.Crashlytics.IsCrashlyticsCollectionEnabled returns true.
I crash the app in a number of different ways, then open it again without reinstalling. But no crash reports are sent.
When I watch logcat when starting the app I see this error from firebase each time the app is opened
2020-09-28 16:18:59.332 25773-25847/? E/FirebaseCrashlytics: Failed to retrieve settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/REDACTEDblahblahblah/settings
Update Oct 19, 2020:
Today a developer updated the issue I linked in this answer saying the Firebase team fixed a backend bug last Friday (Oct 16) that was affecting some new Unity Android apps registering w/ Firebase - likely the bug behind your issue. I had already solved the issue in my own project using the below solution, but if you haven't yet updated your project, I recommend running it again and seeing if Crashlytics is working for you now..
I've been dealing with the same issue this week in Unity 2019.4.11f1 - i see the same error message about not being able to retrieve settings, but with my specific project and appIds in the URL.
I found a solution in this Github issue, which suggests the problem is caused by the version of an android library that is a dependency for the Unity Firebase Crashlytics package. My rough understanding is that the firebase-crashlytics-unity library is a wrapper around android library firebase:firebase-crashlytics, and the unity package allows the underlying native Android code to be used from Unity. Version com.google.firebase:firebase-crashlytics:17.10.0 has issues with getting the settings for some Firebase projects on Android. Myself and several others following this issue found forcing Unity to use this specific dependency at version 17.1.1 resolved the issue.
Someone else with the same issue in the thread contacted Firebase support and was told:
The error you are seeing "Failed to retrieve settings" is related to
the SDK version being used. If you go to "Assets > Firebase > Editor>
CrashlyticsDependencies" you can manually update the SDK to point to
the latest Crashlytics SDK version 17.2.2. Please give it a try and if
you continue having issues, let me know.
It turned out this advice wasn't quite right - some of us following the thread then experienced a different issue when using the Android Crashlytics SDK version 17.2.2 with Unity crashlytics version 6.16.0. So I'd specifically recommend trying out the below suggestion or other solutions in the thread to set your Android crashlytics library to v17.1.1.
Changes I made in my project to address this:
First, I updated my unity firebase packages in the package manager to use version 6.16.0. In my project 4 packages were installed - core, analytics, crashlytics, and messaging.
Then I searched for the the Crashlytics package's dependency file - Crashlytics-Dependencies.xml (found by searching project - was in /Library/PackageCache/com.google.firebase.crashlytics#6.16.0/Firebase/Editor/ for me). This file initally had "com.google.firebase:firebase-crashlytics:17.0.0" listed, which I updated to be: "com.google.firebase:firebase-crashlytics:17.1.1".
As an extra precaution, I also added created a MyProject-Dependencies.xml file, as was suggested by a user in the thread - this file also specifies version "com.google.firebase:firebase-crashlytics:17.1.1".
Next, I modified the Unity build process to use a custom mainTemplate.gradle file to specify dependencies,
rather than using the External Dependency Resolver to manage and
embed unity packages (option in Build Settings > PlayerSettings >
Android).
I also updated the settings on the External Dependency Manager Android Ressolver:
Disabled AutoResolve and Disabled Resolve on Build (we dont want EDM updating dependencies without our knowledge when building)
I also turned disabled AndroidPackageInstallationEnabled - this has made the resolution process much faster and removed a bunch of .aar files from the android dependencies list, and hasn't caused any problems in my project.
I then ran External Dependency Resolver > Android > Force Resolve, which after the settings changes above, should now embed a list of the dependencies for the Android build into the mainTemplate.gradle file - Check this file (its in Assets/Plugins/Android) and you should now see com.google.firebase:firebase-crashlytics:17.1.1 in that list.
Also, I recommend reading this article about managing Unity Firebase dependencies from one of the Firebase developer advocates, Patrick Martin. It helped me wrap my head around how Android dependency management in Unity works, as well as how the Android gradle build process works.
I am new at Swift. I am creating my own framework that will use Firebase for in-app messages.
I tried to install Firebase through Cocoa pods, but it has issues: when I do that for my framework, then for sample project I have to install Firebase again. And then I get the numbers of warnings like this:
Class Firebase is implemented in both /private/var/containers/Bundle/Application/AD85D7EC-2652-4019-94FB-C799D0FBA69B/MyFrameworkExampleApp.app/Frameworks/MyFramework.framework/MyFramework (0x1019a0438) and /var/containers/Bundle/Application/AD85D7EC-2652-4019-94FB-C799D0FBA69B/MyFrameworkExampleApp.app/MyFrameworkExampleApp (0x10107c558). One of the two will be used. Which one is undefined.
my app crashes at runtime due to these warnings
So I don't want to use cocoa pods in Framework but need Firebase in my project.)
.
I follow the steps:
"https://firebase.google.com/docs/ios/setup#frameworks"
I just download the firebase file and import it into my project. after this I try to:
import Firebase
at the top of my swift class but the compiler is giving me an error.
No such module 'Firebase'
I am using Xcode 9. swift 4.
All of the framework files are in
"Targets > FrameworkName > General > Linked Frameworkd and Libraries".
also in the
"Targets > FrameworkName > Build Phases > Link Binary with Libraries".
I also followed this tutorial:
http://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/
but nothing happened.
Where am I wrong and What should I do?
Try adding following #import to framework's public header file "YourCocoaTouchFrameworkNameSwift.h"
#import <YourCocoaTouchFrameworkName/Firebase.h>
Check this link, if you need more information.
in firebase we have not a .framework file for import firebase. As we know that firebase is a combination of different frameworks, so we were unable to import firebase directly. thats why we
import required framework and dependent framework separately.
Dont try to import whole firebase.