Firebase Emulator Error: firebase-tools no longer supports Java version before 11 - firebase

I am using Firebase Functions, Realtime Database & Hosting in my firebase project. I installed & configured local emulator suit for my project. But when I am writing firebase emulators:start command in Visual Studio Code terminal to use emulator, it gives me below Error.
!! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using
the emulators.
i emulators: Shutting down emulators.
Error: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using the emulators.
I tried using firebase emulators:start --only hosting & firebase emulators:start --only functions. Both of them are working fine. But when
I tried firebase emulators:start --only database It gives me the same error.
To check the Java version installed in my windows 10 pc , I typed java -version. in my CMD. It gave me below output.
java version "19.0.2" 2023-01-17
Java(TM) SE Runtime Environment (build 19.0.2+7-44)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)
I am interpreting it as Java version 19 is already installed in my PC.
Please guide me the missing part because of which firebase gives the error for java version.

Related

Android Terminal does not recognise firebase command

I have this weird situation where I am not able to run firebase commands from android studio. I can run such commands in terminal but not in the terminal inside android studio.
As an example if I run firebase login in terminal, I can login but if run it in android studio I get this error: zsh: command not found: firebase.
See below an image to prove this case.
I tried to run the following command and got the following in terminal
MyMac:my_folder myuser$ which firebase
/Users/myuser/.nvm/versions/node/v17.0.1/bin/firebase
MyMac:my_folder myuser$ readlink $(which firebase)
../lib/node_modules/firebase-tools/lib/bin/firebase.js
If I do the same in Android I get nothing. I suspect it is a matter of Android studio not finding the right path to the firebase files?
Any help?
I am on a macOS Ventura and using Android Studio Electric Eel
Thanks so much!!
How did you install firebase tools (locally or globally)?
if you have globally installed firebase-cli,
I suggest you to look into environment PATH variables for both nodejs and firebase tools.
if you have installed locally as a dependancy,
here is a installation guide to install firebase-cli on macOS.
Eitherway, I suggest you to Invalidate cache and restart your Android studio before running the terminal again.

Any solution for firebase packages integration in flutter in MacBook m1 pro

I have a flutter project which is dependent on some firebase services like auth, db etc. It was working fine on mac mini (intel). But on my MacBook pro I can't build project for podfile error. It showing firebase issue. Any solution?
There is no direct solution for the same. But there is a work around for resolving the Podfile related errors. Follow the steps below,
Execute the below command to install ffi from the terminal,
sudo arch -x86_64 gem install ffi
Then in the iOS folder of Flutter project execute the below command to install the pods. You have to run this command every time a new Flutter project is created and if it needs firebase.
arch -x86_64 pod install
Finally run the application in the Android studio

Firebase Cloud Functions emulator throws "exited with code: 1" error

I'm trying to setup my local environment for testing firebase cloud functions. I've followed along with their documentation but now bump into the following error:
Error: firestore: emulator has exited with code: 1
I've found other SO threads regarding this issue but none with my specific logs:
i Starting emulators: ["functions","firestore","hosting"]
⚠ Your requested "node" version "8" doesn't match your global version "12"
✔ functions: Emulator started at http://localhost:5001
i firestore: Logging to firestore-debug.log
✔ firestore: Emulator started at http://localhost:8080
Error: firestore: emulator has exited with code: 1
The firestore-debug.log file does not really hint me in a direction neither:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/cloud/datastore/emulator/firestore/CloudFirestore : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Anyone here an idea what's causing this bug?
Just download the newest JDK version from here
On macOS 10.14 I needed to install the latest openjdk and enable it:
brew install openjdk
During installation it will then display instructions on how to enable the openjdk. For me it was:
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn \
/usr/local/opt/openjdk/libexec/openjdk.jdk \
/Library/Java/JavaVirtualMachines/openjdk.jdk
In case anyone still struggles with this:
Run your emulators:start command again with --debug at the end to see why the process is crashing, right in the terminal.
To check whether you have installed JDK run:
javac -version
If no JDK found, so download it from here:
https://www.oracle.com/java/technologies/javase-downloads.html
(always latest version).
In addition of downloading JDK, I also needed to restart the computer.
It is more convenient to use AdoptOpenJDK installer for Windows to get the environment setup automatically.
How to install OpenJDK 11 on Windows?
https://adoptopenjdk.net/
You will still need to refresh your cmd or powershell to get access to the new environment variables PATH and JAVA_HOME the installer setup.

Firebase Functions Upgrading to Node 8

Does the version of Node.js on my development machine / integrated development environment (IDE) machine have any effect on my ability to upgrade my Firebase Cloud Functions Node.js runtime to version 8?
I finally got my functions Node.js runtime upgraded to v8 but I had a difficult time doing it. I eventually installed node version manager, nvm, to nail my development machines Node version to 8.0.0 but then ran into the 8.0.0 issue w/ firebase-tools. "must use 8.1.0. 8.0.0 fails"
nvm install v8.1.0
nvm alias default 8.1.0
So, running Node.js v8.1.0 on my development machine seemed to be the breakthrough. I'd like to know but don'e have time to spend on recreating it all.

Cloud 9 and meteor apps

Can I Build a meteor android app in cloud 9.
meteor add-platform android
Because Im running on windows or should I install linux and run
curl https://install.meteor.com/ | sh
and build it locally.
If you want to build android app on Windows you need to be using the meteor 1.3 release beta which you can install by running meteor update --release 1.3-cordova-beta.5 in your project folder - Details on this release
Prior to 1.3 you will need to build the app on a linux machine
You can build a Meteor app on Cloud9 using any version of Meteor. See Meteor on Cloud9.

Resources