Android Studio Tools -> Firebase doesn't work, IDE Error occuring - firebase

When I try to open the Firebase assistent in Tools > Firebase an IDE Error occurs.
I've already tried to reinstall the Google Repository needed for this tool, reactivating the firebase plugins, and also reinstalled Android Studio (though without deleting all user settings).
Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
IDE Error:
Exeption in plugin Firebase Services. Moments ago. Occured 2 times since last clear. Undread. Disable Plugin.
null
java.util.NoSuchElementException
at com.google.common.collect.Iterators$1.next(Iterators.java:81)
at com.google.services.firebase.DependencyStateManager.getDependencyState(DependencyStateManager.java:60)
at com.google.services.firebase.DependencyStateManager.init(DependencyStateManager.java:109)
at com.android.tools.idea.assistant.view.StatefulButton.<init>(StatefulButton.java:122)
at com.android.tools.idea.assistant.view.TutorialStep.<init>(TutorialStep.java:106)
at com.android.tools.idea.assistant.view.TutorialCard.redraw(TutorialCard.java:153)
at com.android.tools.idea.assistant.view.TutorialCard.<init>(TutorialCard.java:90)
at com.android.tools.idea.assistant.view.FeaturesPanel.<init>(FeaturesPanel.java:84)
at com.android.tools.idea.assistant.AssistSidePanel.<init>(AssistSidePanel.java:81)
at com.android.tools.idea.assistant.AssistToolWindowFactory.createToolWindowContent(AssistToolWindowFactory.java:37)
at com.android.tools.idea.assistant.OpenAssistSidePanelAction.lambda$openWindow$0(OpenAssistSidePanelAction.java:59)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:650)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

A quick search brought up the following procedure to fix the issue:
go to Settings > Plugins.
remove all Firebase plugins.
restart Android Studio.
back to Settings > Plugins.
enable the Firebase plugins again.
restart Android Studio.

Related

I can't configure MacOS project to work with Firebase

I have added the GoogleService-info-plist to the project.
I have checked and both the MacOs project and the Firebase's project have the same BundleID.
I also had donde several projects with iOS/SWiftUI and Firebase with no issues.
This is the first time I'm trying to connect Firebase to a MacOs project.
I have also deleted the GoogleService-info-plist file from the MacOs project, downloaded it again and added it via the XCode project/Add file process but I'm still getting this crash message...
2022-01-13 11:03:44.260253-0500 WebScraper[33494:19053189] 8.10.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2022-01-13 11:03:44.268425-0500 WebScraper[33494:19052756] *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'FirebaseApp.configure() could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.
Any ideas?

Flutter app crashes when it use Firestore plugin in Release mode

Everything works perfectly when in debug mode. It first happened when I update Flutter version to 1.10.x I could not remember which version did I use, properly. It should be 1.7.8, it was stable. To fix it I downgrade the flutter to 1.7.8+4 and also downgrade firebase related pub packages. But error still here.
Stack Trace for Related Error, captured from gogle play console
java.lang.RuntimeException:
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:379)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run (AsyncQueue.java:2)
at android.os.Handler.handleCallback (Handler.java:790)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:7000)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.AbstractMethodError:
at com.google.protobuf.GeneratedMessageLite.a (GeneratedMessageLite.java:1319)
at com.google.firebase.firestore.proto.WriteBatch.s (WriteBatch.java:120)
at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:162)
at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:15)
at com.google.firebase.firestore.proto.WriteBatch$Builder.a (WriteBatch.java:835)
at com.google.firebase.firestore.local.LocalSerializer.a (LocalSerializer.java:172)
at com.google.firebase.firestore.local.SQLiteMutationQueue.a (SQLiteMutationQueue.java:188)
at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:237)
at com.google.firebase.firestore.local.LocalStore$$Lambda$2.get (LocalStore.java:8)
at com.google.firebase.firestore.local.SQLitePersistence.a (SQLitePersistence.java:195)
at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:201)
at com.google.firebase.firestore.core.SyncEngine.a (SyncEngine.java:227)
at com.google.firebase.firestore.core.FirestoreClient.a (FirestoreClient.java:200)
at com.google.firebase.firestore.core.FirestoreClient$$Lambda$11.run (FirestoreClient.java:6)
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:311)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call (AsyncQueue.java:2)
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:287)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run (AsyncQueue.java:4)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:457)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run
(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run (AsyncQueue.java:205)
at java.lang.Thread.run (Thread.java:764)
When I saw the error trace on device (in android crash report dialog) It mentioned Firebase 19.0.0
Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.1069], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2017 15.9.7)
[√] Android Studio (version 3.4)
[√] VS Code, 64-bit edition (version 1.38.1)
[√] Connected device (3 available)
• No issues found!
Error reporoducing scenario for final describe:
Build app with flutter run --release
App try an basic firestore call
Firestore.instance.collection('collection-name').document('docuemnt-id').get()
App crashes.
Also getting the same error with building with flutter build appbudle
Here is the solution of my nightmare.
EDIT:
Error
FATAL EXCEPTION: main
Process: com.app.android, PID: 12668
java.lang.RuntimeException: Internal error in Firestore (19.0.0).
at com.google.firebase.firestore.g.j.a(:379)
at com.google.firebase.firestore.g.g.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
To fix this error, update android.enableR8=false in gradle.properties. You need to add this row cause default value true.
I was facing the same problem, and the following changes to my build.gradle solved it.
android {
compileSdkVersion 28
...
buildTypes {
release {
shrinkResources false
minifyEnabled false
signingConfig signingConfigs.release
}
}
}
Reference: https://github.com/FirebaseExtended/flutterfire/issues/1412#issuecomment-570161645
N.B. I know its not a perfect solution to disable minify. But it seems the firebase team is working on it and will be resolved in future update
I was able to keep android.enableR8=true by upgrading the gradle version.
android/build.gradle
from:
classpath 'com.android.tools.build:gradle:3.2.1'
to:
classpath 'com.android.tools.build:gradle:3.5.0'
android/gradle/wrapper/gradle-wrapper.properties
from:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
to:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
I have a similar case (same error), so I'll try to tell you what happened and maybe is the same issue that you have.
In my case I lost the keystore, so I pass through all the process of ask for a new key and so on, after that I publish a new version and my app crash in the exact way of yours, after a lot of google and stuff I figured out that have something to do with the signature (because works in debug but do not work in release), so I get into the firebase console and download again the google-services.json file, and surprise... the file have a block that wasn't there before.
After that, I test in a device with the command that you provide here (by the way thanks!), and woala! It works.
I also update the SHA-1 Signature key in the console, so that may help too.
I hope that my response help you to come out to some solution.
https://github.com/flutter/flutter/issues/41576
changing to version 3.4.2 i.e com.android.tools.build:gradle:3.4.2 in build.gradle(project) , worked for me.

Cant find Firebase Assistant in Android Studio 3.3

I just updated Android Studio to version 3.3 and I'm looking to create a new Firebase application using the Firebase Assistant. But I dont see it under tools.
I checked which plugins I have installed and I have all three firebase plugins.
I checked which Google Repository I have under SDK Manager, and I'm on 58
When I do a search of Android Studio I can find it but when I press enter I get this error:
java.util.NoSuchElementException
at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:75)
at com.google.services.firebase.DependencyStateManager.getDependencyState(DependencyStateManager.java:59)
at com.google.services.firebase.DependencyStateManager.init(DependencyStateManager.java:108)
at com.android.tools.idea.assistant.view.StatefulButton.<init>(StatefulButton.java:98)
at com.android.tools.idea.assistant.view.TutorialStep.<init>(TutorialStep.java:114)
at com.android.tools.idea.assistant.view.TutorialCard.redraw(TutorialCard.java:161)
at com.android.tools.idea.assistant.view.TutorialCard.<init>(TutorialCard.java:94)
at com.android.tools.idea.assistant.view.FeaturesPanel.<init>(FeaturesPanel.java:84)
at com.android.tools.idea.assistant.AssistSidePanel.<init>(AssistSidePanel.kt:79)
at com.android.tools.idea.assistant.AssistToolWindowFactory.createToolWindowContent(AssistToolWindowFactory.java:44)
at com.android.tools.idea.assistant.OpenAssistSidePanelAction.openWindowNow(OpenAssistSidePanelAction.java:68)
at com.android.tools.idea.assistant.OpenAssistSidePanelAction.lambda$openWindow$0(OpenAssistSidePanelAction.java:49)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:758)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

VS 2017 Community ver and VS 2017 Enterprise debug issue: Found conflicts between different versions

I m having 2 version of VS2017 and a mac with latest macOS.
I transfer my Xamarin forms App file from VS2017 enterprise to a machine(more than 3 years old but running win10 pro) with VS2017 Community version. When I debug ( with selecting Android project and VS-android-23 X86 tablet as emulator ) this App in VS2017 Community version , I have no compilation error but have these message:
Found conflicts between different versions of the same dependent assembly
that could not be resolved.
These reference conflicts are listed in the build log when log verbosity is set to detailed.
I could not understand this message. I have no problem running the same app in VS2017 Enterprize ver but I have this error message in VS2017 Community ver.
Update
Click View > Output --> this will show the error
1>Starting deploy VisualStudio_android-23_x86_tablet ...
1>Starting emulator VisualStudio_android-23_x86_tablet ...
1>C:\Users\xxxxx\AppData\Local\Android\ANDROI~1\tools\emulator.EXE -partition-size 512 -no-boot-anim -avd VisualStudio_android-23_x86_tablet -prop monodroid.avdname=VisualStudio_android-23_x86_tablet
1>emulator: ERROR: x86 emulation currently requires hardware acceleration!
1>Please ensure Intel HAXM is properly installed and usable.
1>CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
1>Emulator VisualStudio_android-23_x86_tablet cannot be started.
Please help.

VS BlankCordovaApp Won't Run on Emulator

Recently installed VS 2015 Community Update 3 in Windows 10 Pro 32 bit. For the past couple days I have been playing with Cordova, but can not get it to work correctly.
I tried:
Redirect index.html hack.
Clearing cache in TACO settings
Repaired VS
This text is from the build log / VS / emulator / debug log / me.
Build: Warning: No emulator specified, defaulting to AVD_GalaxyNexus_ToolsForApacheCordova
Build: Failed to create Context 0x3005
VS: There were deployment errors. Continue?
Me: If I click Yes
Build: Debug is starting
Emulator: "The connection to the server was unsuccessful. (file:///android_assset/www/index.html)"
Me: App appears 3 times on emulator
Me: Breakpoints don't work. In the Debug log I see many messages "Cannot find or open the PDB file."
Me: Build log says the app was installed but Deploy failed?
Build:
Installing apk C:/Users/pears/Documents/Visual Studio 2015/Projects/BlankCordovaApp1/platforms/android/build/outputs/apk/android-debug.apk on emulator-5554...
INSTALL SUCCESS
Unlocking screen...
Running command "input keyevent 82" on emulator-5554...
Starting application "io.cordova.myapp6178b0/.MainActivity" on emulator-5554...
Running command "am start -W -a android.intent.action.MAIN -nio.cordova.myapp6178b0/.MainActivity" on emulator-5554...
LAUNCH SUCCESS
Executing "after_run" hook for all plugins.
Warning: No emulator specified, defaulting to AVD_GalaxyNexus_ToolsForApacheCordova
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Me: I don't see any errors in the build log.
Update 7.22.2016
I created a new Azure VM (Windows 2012 R2 Datacenter, 64 bit, 2 core Intel 2.2, 7 GB RAM) and installed VS 2015 and Cordova. From the AVD manager, the base emulator started up fine. However, the deploy still failed for a blank Cordova project. I saw the white Cordova screen saying it was connecting to device. Then the same message "The connection to the server was unsuccessful. (file:///android_assset/www/index.html)". Maybe the Redirect index.html hack will help. I didn't try.
Next, I Installed the stand-alone Android Studio in my desktop Windows 10 VM for more options with the AVD and SDK. Immediately, it tells me my CPU doesn't support VT-x. Makes sense - it's an AMD processor. I started the AVD GalaxyNexus ToolsForApacheCordova emulator anyway and it never finished loading. It targets API 19, Android 4.4, and arm CPU. I tried upgrading to API 23 which refused to run and says:
Intel HAXM is required to run this AVD.
Your CPU does not support required features (VT-x or SVM).
Unfortunately, your computer does not support hardware accelerated virtualization.
Here are some of your options:
1) Use a physcal device for testing
2) Develop on a Windows/OSX computer with an Intel processor that supports VT-x and NX
3) Develop on a Linux computer that supports VT-x or SVM
4) Use an Android Virtual Device based on an ARM system image
(This is 10x slower than hardward accelerated virtualization)
It seems like VS failed to create an Android Virtual Device. You can create one in the version of Android Studio that VS installs on your machine. The default location is in "C:\Users[usename]\AppData\Local\Android\sdk\". Click on "Avd Manager" and create a device. Make sure its the only device created--any existing ones may be broken. Then, go back to VS and click "Android -> Build to Google Android emulator".
FYI--if you have Hyper V enabled (you are using a Windows Phone emulator), you should be selecting the ARM system image.

Resources