I'm following this tutorial that uses Ionic framework and Firebase backend to create an image recognition app https://www.youtube.com/watch?v=taPczl94Eow
For this line:
import * as vision from '#google-cloud/vision'
I keep getting the error:
Could not find a declaration file for module '#google-cloud/vision'.
'/Users/Private/Workspace/project/functions/node_modules/#google-cloud/vision/src/index.js' implicitly has an 'any' type.
Try `npm install #types/google-cloud__vision` if it exists or add a new declaration (.d.ts) file containing `declare module '#google-cloud/vision';`
What should I do? I already installed it properly. I also enabled the API from the GCP platform and followed their instructions
I was also having the same problem, so I had to replace this line:
import * as vision from '#google-cloud/vision'
For this line (it works with Typescript):
const vision = require('#google-cloud/vision');
I hope this works for your case.
Related
Firebase cloud functions database.d.ts has the following comment which throws warnings in my IDE and when I deploy my project:
/** #deprecated Removed in next major release to match Web SDK typings. */
path: string;
In many of my cloud functions, I create dictionaries with the keys being paths to realtime database nodes whenever I want to update entries.
This is the exact behavior I need and works without any issues. However, every time I deploy my cloud functions I'm greeted with over 50 warnings that:
path is deprecated: Removed in next major release to match Web SDK typings.
The terminal call that creates these warnings is:
Running command: npm --prefix "$RESOURCE_DIR" run lint
Without the path variable, I'd have to create a custom function to create a path from the DatabaseReference's key and parent keys. That sounds absurd. Is this possibly a lint issue?
There's nothing to indicate in the documentation that they're removing the path variable, and I hate seeing this warning spammed every time I deploy my functions. Is this a legitimate warning, and if so, is there a replacement way of getting the path from a DatabaseReference built into the sdk?
path property deprecated in version 9+ of the node SDK –
Try do a ref.toString() and remove the base URL
Consider:
var adaRef = firebase.database().ref("users/ada");
adaRef.toString()
Will print the full URL: https://firebaseio.com/users/ada
So to just get the path, you substring it out of there. Two ways of doing that are:
adaRef.toString().substring(firebase.database().ref().toString().length-1)
Or:
adaRef.toString().substring(adaRef.root.toString().length-1)
both will print /users/ada
Looking at this pull request[1] on the Admin SDK open-source repo, it looks like the path property was deprecated to create type compatibility between the JavaScript/web SDK and the Node.js Admin SDK.
The client-side JavaScript SDK for Firebase Realtime Database never had a path property. The way to get the path has always been to call toString() explicitly, or to include the reference in a string concatenation.
i am trying to use firebase new feature which is App check for flutter app in android emulator.
i am trying to activate the debug provider for android by following this instructions app check .
for line "firebaseAppCheck.installAppCheckProviderFactory(
DebugAppCheckProviderFactory.getInstance());" , i got error message that says The method 'installAppCheckProviderFactory' isn't defined for the type 'FirebaseAppCheck'
does anyone know how to solve this problem
I have run into the same problem myself.
It's not stated on this page but the imports you need are:
import com.google.firebase.FirebaseApp;
import com.google.firebase.appcheck.FirebaseAppCheck;
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
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.
Currently I am getting a warning :
It looks like you're using the development build of the Firebase JS SDK.
When deploying Firebase apps to production, it is advisable to only import
the individual SDK components you intend to use.
For the CDN builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):
https://www.gstatic.com/firebasejs/5.0.0/firebase-<PACKAGE>.js
I have gone through several related links to this problem but even after following all their solutions, I am not able to remove the error.
As the description says to use the given link with the name of the component I am using. I have included the links which I need, still I see the warning.
I have even tried to include all the links given in Firebase website, still I see it.
Currently I am only using Firebase Realtime Database, but while creating firebase init using CMD, I had included Functions, Hosting, Storage and Database.
<script src="https://www.gstatic.com/firebasejs/5.0.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.0.0/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.0.0/firebase.js"></script>
I have even tried changing the versions from 5.0.0 to 5.4.0, but no use.
How to solve this?
I have just solved it by adding two scripts.
<script src="https://www.gstatic.com/firebasejs/5.0.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.0.2/firebase-database.js"></script>
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.