Flutter and Firebase authentication via Facebook: Lost connection to device - flutter

I'm trying to setup Flutter-Firebase-Facebook social authentication as defined here. I used just the example given in the docs and after I execute flutter run and click the 'Login' button on the simulator, the app exits and what I can see from the logged message is just:
[ +4 ms] Lost connection to device.
Step I followed are the following:
I setup the Facebook App as described in here;
I also setup the Flutter project for iOS and Android as defined in here;
I ran the exact example described in the flutter_facebook_auth page;
What I've checked so far is:
Memory is enough;
flutter doctor does not show any issue.
Version of deps I am using are:
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
flutter_facebook_auth: ^2.0.1
Version of flutter, sdk etc are all latest. Running on Big Sur 11.1
Does anyone know what I can investigate further?

i had same issue, make sure your CFBundleURLSchemes starts with fb
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<!--
Replace "000000000000" with your Facebook App ID here.
**NOTE**: The scheme needs to start with `fb` and then your ID.
-->
<string>fb000000000000</string>
</array>
</dict>
</array>

I ran into this and went back through the installation guide to make sure I got everything. What fixed it for me was making sure I had these two properties set in the Info.plist:
<key>FacebookAppID</key>
<string>{your-fb-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>

Related

Android Emulator 30.4.5 not working on MacOS

System Info
MacOs Version - 11.3 Beta
Android Studio Version - 4.1.2
Android Emulator Version - 30.4.5
Android HAXM Version - 7.5.1
Error Stack
emulator: Android emulator version 30.4.5.0 (build_id 7140946) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/rajaparikshit/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
Failed to open the hax module
No accelerator found.
qemu-system-x86_64: failed to initialize HAX: Operation not supported by device
added library /Users/rajaparikshit/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/rajaparikshit/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
added library /Users/rajaparikshit/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
Android emulator version - 30.0.26 was running perfectly as expected. But after 30.4.5.0 update its not working.
I tried to search way to downgrade to 30.0.26 but I couldn't find one i.e. there is no any option in android studio manager also.
I saw this SO post. Google store all the emulators version in repository URL - http://dl.google.com/android/repository/ but I didn't know the build version for 30.0.26 version so couldn't go this way.
Update -
Please follow the accepted answer below and do give upvote.
For newbies or if you get stuck at any point please follow the steps:
If you have uninstalled the latest version of emulator as its not working, then please install it again. (Because if we manually replace the emulator directory Android Studio is not able to recognise it and hence you won't able to create/run AVD from Android Studio)
Download the zip file from the URL mentioned in answer.
Copy(Not Move) the content to your original emulator directory.
Restart the android studio if needed.
Still this is just a workaround, actual issue with this new version is still there.
Below is a temporary fix.
Error:
cannot add library
/Users//Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib:
failed
It seems the dylib file doesn’t exists in the path specified in the error message.
However, the library exists in the path below:
~/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
Symlink vaulkan lib to the path emulator is trying to load the library from:
ln -s ~/Library/Android/sdk/emulator/lib64 ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64
Error 2:
Then I got an error related to code signing.
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
Fix the code signing error:
Step 1:
Create the app.entitlements file for codesigning and add below content (source: https://www.reddit.com/r/VFIO/comments/kdhgni/qemu_hvf_support_for_mac_os_x_bug_sur_hv_error/):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <dict> <key>com.apple.security.hypervisor</key> <true/> </dict> </plist>
Step 2:
Perform codesign:
codesign -s - --entitlements ~/<path>/<to>/app.entitlements --force ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
Launch the emulator:
~/Library/Android/sdk/emulator/emulator -avd Pixel_4_API_30 -gpu auto
Emulator should load without any errors. Hope this helped.
UPDATE: This issue no longer exists in the current version of the emulator. Please refer to #channe's comment to revert the change after upgrading AS/emulator.
Here is the link for the emulator revision 30.0.26 https://dl.google.com/android/repository/emulator-darwin-6885378.zip
(taken from this answer)
Download it and then copy over the installed emulator.
It won't work if you have files quarantine enabled; I did so I needed to remove quarantine recursively from downloaded files
xattr -r -d com.apple.quarantine /path/to/dir
Then I can run the emulator by invoking:
emulator #device_name
It doesn't seem to be detected by AS, but works nonetheless.
I had the same issue on a Mac. I was able to fix it be updating Android Emulator to 30.6.5 from Android Studio -> Sdk Manager -> Android Sdk -> SDK Tools.
Also I had to install Intel x86 Emulator Accelerator (HAXM Installer).
Please update your android build tools to latest version avaialble in the studio, this will update your emulator binary and all libs(.dylibs). This is the correct fix..

ERROR with flutter: CocoaPods not installed even if it is installed

I am trying to run my code on AndroidStudio by using Flutter but when I run it shows an error:
Warning: CocoaPods not installed. Skipping pod install. CocoaPods is
used to retrieve the iOS and macOS platform side's plugin code that
responds to your plugin usage on the Dart side. Without CocoaPods,
plugins will not work on iOS or macOS. For more info, see
https://flutter.dev/platform-plugins To install see
https://guides.cocoapods.org/using/getting-started.html#installation
for instructions.
CocoaPods not installed or not in valid state. Error launching
application on iPhone 11.
flutter doctor shows that all is fine, I looked around a lot and tried lots of things like uninstall it and install it again, and tried adding:
dev_dependencies:
build_runner: ^1.10.0
dependency_overrides:
analyzer: 0.39.14
and tried
flutter channel stable
flutter upgrade
and tried
flutter channel master
flutter upgrade
But nothing worked, note that when I write "which pod" it shows the path, that means it exists right? then what is the problem? please help :(
have you tried to run pod install from the ios folder?
The only thing that worked with me is using android emulator, ios simulator still show the same error
I had the same issue and I found a solution, but with still an answered question. See my question (and one partial solution) here
The partial solution is: in Android Studio, click on the tab "Terminal" at the bottom of the IDE and in this pane, type flutter run. It does the same as the button Run, and Android Studio stopped complaining about CocaPods.
To stop the app, type q in the same terminal.

Flutter Web cloud_firestore package: Versions newer than 0.12.11 produces just a blank web page

When I run the command: flutter build web => I get a blank web page. If I use cloud_firestore::0.12.11 OR older, all runs perfectly well.
Steps to reproduce the behavior:
flutter doctor. No issues found.
flutter run -d chrome. The app runs OK on the local browser.
flutter build web. The app runs and shows a blank page.
In pubspec.yaml: remove the dependency cloud_firestore: The app runs OK.
In pubspec.yaml: add the dependency cloud_firestore:0.12.11 (older version), The app runs OK.
Expected behavior
I need to use cloud_firestore: 0.14.0+2 so I can use the data type FirebaseFirestore.
Are you also using other firebase packages? I have found there are issues with firebase_auth - including a black screen.
Make sure you following the Migration Guide: https://firebase.flutter.dev/docs/migration/#plugin-changes
The issue was with a bug in the library itself.

WKWebview runs fine in iOS 10, freezes in iOS 9

I installed the WKWebview plugin from driftyco Github page and my app runs normally in ios 10. However, when I installed the app on iOS 9, the app freezes at the splash screen.
I read about the ATS and in my info.plist, I have this value
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Here is my access-origin and allow-navigation tag
<access origin="*" />
<allow-navigation href="*" />
What else do I need to do to make WKWebview work? I have WKWebview v1.1.1 and Cordova iOS 4.1.1.
I also noticed an error "DOM Exception 18: An attempt was made to break through the security policy of the user agent."
Another interesting error is
[Error] module cordova-plugin-nativestorage.NativeStorageError already defined
define (cordova.js:79)
Global Code (NativeStorageError.js:1)
[Error] Failed to load resource: unsupported URL (ready, line 0)
Please help!

Can I upgrade UIRequiredDeviceCapabilities from opengles-1 to opengles-2 in iOS app

Hi I’m upgrading my app from cocos2d-x 1.x to 2.x that means change from OpenGLES 1.0 to 2.0,
I've updated my Info.plist settings to reflect the change
<key>UIRequiredDeviceCapabilities</key>
<dict>
<key>accelerometer</key>
<true/>
<key>opengles-2</key>
<true/>
</dict>
Change from opengles-1 to opengles-2
But while installing application from XCode 4.5 GM (the older version was compiled with prevoius XCode) I receive error:
Could not change executable permissions on the application