Flutter and android studio error: Google Play Store is missing - android

I am getting this error while doing google Authentication using firebase. When I run my app, Buffering comes while clicking on google button.
name: google_signin_example
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
# google sign in
firebase_auth: ^1.4.1
google_sign_in: ^5.0.4
firebase_core: ^1.3.0
# state management
provider: 5.0.0
# icon of google
font_awesome_flutter: 9.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
this is the pub spec.yaml file.
Error:
Launching lib/main.dart on Android SDK built for arm64 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:52271/JcyHJ3SiTHE=/ws
Syncing files to device Android SDK built for arm64...
W/GooglePlayServicesUtil( 2685): Google Play Store is missing.
W/GooglePlayServicesUtil( 2685): Google Play Store is missing.
W/DynamiteModule( 2685): Local module descriptor class for com.google.android.gms.auth.api.fallback not found.
E/flutter ( 2685): [ERROR:flutter/lib/ui/ui_dart_state.cc(213)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 12500: , null, null)
E/flutter ( 2685): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
E/flutter ( 2685): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter ( 2685): <asynchronous suspension>
E/flutter ( 2685): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
E/flutter ( 2685): <asynchronous suspension>
E/flutter ( 2685): #3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:235:30)
E/flutter ( 2685): <asynchronous suspension>
E/flutter ( 2685): #4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart)
E/flutter ( 2685): <asynchronous suspension>
E/flutter ( 2685):

I solved this error by creating a new virtual device that implements the Google Play Store services (It is needed for Google Login).
Open Android Studio > AVD Manager > Create Virtual Device
Choose a device that implements the Play Store, like shown in the following image:
Screenshoot of Virtual device with Google Play Services included
If it doesn't work, you could try to test the feature using a Virtual Device using the "API 29" (Android 10).
Hope it was helpful!

Related

Flutter Google Sign In error after selecting User Id: PlatformException(sign_in_failed, v1.b: 10: , null, null)

I'm currently developing a Flutter Application for android and the web. However, the google sign-in feature is not working in the release mode or when you install an APK. It does work in Debug and Profile modes. I've tried numerous solutions, including changing the version dependencies of all firebase packages and the Google sign-in package. Updated Gradle, fixed the warning for "JAR files in the classpath should have the same version" and tried a few possible logic changes in the Authentication service code. Although the latter hardly seems to be the problem because the code is working in Debug mode and it was also previously working smoothly (in all modes).
I should mention the fact that I have added both SHA certificates (SHA 1 and SHA 256) from my laptop and also from the play store to make it ready for publishing but it didn't change anything. I also tried removing the Playstore SHA certificates but it doesn't help the problem either.
The error appears after the user clicks on the "Sign In with Google" Button and selects their google account. Below is the exact error I am facing (apart from Google Sign in other authentication services work).
E/flutter (13968): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(sign_in_failed, v1.b: 10: , null, null)
E/flutter (13968): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607)
E/flutter (13968): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167)
E/flutter (13968): <asynchronous suspension>
E/flutter (13968): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:367)
E/flutter (13968): <asynchronous suspension>
E/flutter (13968): #3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:266)
E/flutter (13968): <asynchronous suspension>
E/flutter (13968): #4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:399)
E/flutter (13968): <asynchronous suspension>
E/flutter (13968):
These are the version numbers of all my flutterfire packages and also google sign in:
cloud_firestore: ^3.3.0
firebase_auth: ^3.5.1
firebase_core: ^1.20.1
firebase_messaging: ^12.0.0
firebase_storage: ^10.2.18
google_sign_in: ^5.4.0
firebase_analytics: ^9.2.1
NOTE: There is also a web version of the app, that is running fine in all run modes.
I would really appreciate any inputs on this problem! Thank you.
EDIT: Figured it out. Your release and debug SHA keys are different. First of all, add your debug SHA keys to firebase if it still doesn't work, add your release SHA key to firebase. Hope it will work!

using Agora - PlatformException(7, not initialized, null, null)

E/flutter (31727): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(7, not initialized, null, null)
E/flutter (31727): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (31727): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (31727): <asynchronous suspension>
I am using Agora for Flutter for video broadcasting.
I am getting above exceptions when I leave channel and destroy rtc engine. Any hints to fix this? There are no logs suggesting reason for the error.
here:
const ErrorCode(7)
NotReady → const ErrorCode
The SDK module is not ready. Possible
solutions:
Check the audio device.
Check the completeness of the app.
Re-initialize the SDK.
You may check your code about the engine's create.
The error code 7 occurs when the SDK fails to initialize. Most commonly the error can be due to an incorrect APP ID or missing/expired token.

Cannot create a directory in application folder using Flutter after upgrading to Android 11

I have a couple of directories that need to be created if they do not exist on the app's first run. These directories have to be created within the application's support directories. I do not need to use external directories for this app. So, I am sure I do not need to add any permissions for the app in the application manifest for accessing external storage directories. Here is my code in the main() function:
Future<void> main() async {
//This line is needed to use the main function as a Future
WidgetsFlutterBinding.ensureInitialized();
Directory directory = await getApplicationSupportDirectory();
//Create downloads paths if they do not exist
Directory literatureDirectory = Directory("${directory.path}/downloads/literature");
Directory audioLecturesDirectory = Directory("${directory.path}/downloads/audioLectures");
if (!(await literatureDirectory.exists())) {
Directory literatureNewDirectory = await literatureDirectory.create();
}
if (!(await audioLecturesDirectory.exists())) {
Directory audioLecturesNewDirectory = await audioLecturesDirectory.create();
}
runApp(ULTApp());
}
I am using a Samsung mobile device which was recently upgraded to Android 11 (One UI 3). While developing my app, I had to uninstall and re-install it. Whenever I try to re-install it, I get the following error:
E/flutter (22527): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FileSystemException: Creation failed, path = '/data/user/0/com.example.app_name/files/downloads/literature' (OS Error: No such file or directory, errno = 2)
E/flutter (22527): #0 _Directory.create.<anonymous closure> (dart:io/directory_impl.dart:117:11)
E/flutter (22527): #1 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (22527): #2 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (22527): <asynchronous suspension>
E/flutter (22527): #3 main (package:app_name/main.dart:24:40)
E/flutter (22527): <asynchronous suspension>
E/flutter (22527):
What should I do to fix the error? Thanks

Flutter, IOS, App with name __FIRAPP_DEFAULT does not exist

I am new to IOS. I followed the guide and ran the code running on Android on IOS.
But in the log appears
021-02-18 13:02:42.035498+0900 Runner[449:77215] Metal API Validation Enabled
2021-02-18 13:02:42.128775+0900 Runner[449:77215] Configuring the default Firebase app...
2021-02-18 13:02:42.129033+0900 Runner[449:77424] 6.33.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
2021-02-18 13:02:42.132427+0900 Runner[449:77215] Configured the default Firebase app __FIRAPP_DEFAULT.
2021-02-18 13:02:42.174670+0900 Runner[449:77440] flutter: Observatory listening on http://127.0.0.1:51553/bOh9A8fqOm4=/
2021-02-18 13:02:42.506046+0900 Runner[449:77425] 6.33.0 - <AppMeasurement>[I-ACS025027] Deferring to Google Analytics for Firebase for event data collection.
2021-02-18 13:02:42.627177+0900 Runner[449:77215] WF: === Starting WebFilter logging for process Runner
2021-02-18 13:02:42.627226+0900 Runner[449:77215] WF: _userSettingsForUser mobile: {
filterBlacklist = (
);
filterWhitelist = (
);
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2021-02-18 13:02:42.627266+0900 Runner[449:77215] WF: _WebFilterIsActive returning: NO
2021-02-18 13:02:42.672715+0900 Runner[449:77429] [VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method addFlags on channel flutter_windowmanager)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
#2 FlutterWindowManager.addFlags (package:flutter_windowmanager/flutter_windowmanager.dart:44:27)
#3 main (package:k_leetory/main.dart:14:30)
<asynchronous suspension>
#4 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:231:25)
#5 _rootRun (dart:async/zone.dart:1190:13)
#6 _CustomZone.run (dart:async/zone.dart:1093:19)
#7 _runZoned (dart:async/zone.dart:1630:10)
#8 runZonedGuarded (dart:async/zone.dart:1618:12)
#9 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:223:5)
#10 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
#11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
2021-02-18 13:05:02.684451+0900 Runner[449:77432] [VERBOSE-2:profiler_metrics_ios.mm(184)] Error retrieving thread information: (ipc/send) invalid destination port
2021-02-18 13:10:21.957514+0900 Runner[449:77432] [VERBOSE-2:profiler_metrics_ios.mm(184)] Error retrieving thread information: (ipc/send) invalid destination port
I bother this part "App with name __FIRAPP_DEFAULT does not exist."
GoogleService-info.plist and info.plist are perfect. When I made an ios app in firebase, I couldn't do the same with the flutter package name. Because when setting up the flutter android project. I put it underscore in the name and this worked fine. However, the ios app was made differently because underscore is prohibited when you put the package name.
the weird thing is it is keep showing only white screen
So my question is if android flutter name and ios flutter name are different, will this be a problem in firebase?
Yes both the package name different in Android & ios will work fine in firebase , because Android and ios will have different GoogleService and GoogleService Info.plist

Flutter: Missing Plugin Exception Raised when running release builds of android app

Issue
I am currently working on an app which uses multiple packages.
The app works like a charm in both debug and profile modes. But when I get the release build and run it, some features do not work.
The reason is a couple of the plugins are not working as intended. This is what I get in the debug console :
E/flutter (14180): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
E/flutter (14180):
E/flutter (14180): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
Another case during the same run
E/flutter (14180): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getStorageDirectory on channel plugins.flutter.io/path_provider)
E/flutter (14180): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
E/flutter (14180): <asynchronous suspension>
E/flutter (14180): #1 getExternalStorageDirectory (package:path_provider/path_provider.dart:120)
E/flutter (14180): <asynchronous suspension>
E/flutter (14180): #2 ChatScreenState._init (package:pryzcrybdoctor/Screens/Chats/chat.dart:716)
E/flutter (14180): <asynchronous suspension>
E/flutter (14180): #3 ChatScreenState._prepare (package:pryzcrybdoctor/Screens/Chats/chat.dart:736)
E/flutter (14180): <asynchronous suspension>
I have not used path_provider in my app, it is a transitive dep from a plugin cached_network_image
I got the same exception with permission_handler plugin in this same app, but I removed it to check if permission handler was the issue, but now I can't access camera.
The thing that gets me confused is that all these issues only arise in the release mode. Everything works perfectly in debug and release.
Some weird things I noticed...
It seems that some plugin or plugins are still using the "non AndroidX" support libraries. This is because I have to go through the "build debug then build profile and finally then release" cycle to get the release version built. I've read once that this is when Jetifier is working on some plugins that have not fully migrated. So my best guess is that the issue is with some plugin not fully migrated.
What I have tried so far..
Rebuilding the app multiple times.
flutter clean and then flutter build
flutter pub upgrade
Build using android studio.
Migrate to AndroidX using android studio.
Please let me know if you need more info or logs. Thank you for your time.
Got the solution to this issue from a Flutter GitHub issue.
Just keeping androidx.lifecycle.DefaultLifecycleObserver is enough.
Add the below line to app/proguard-rules.pro:
-keep class androidx.lifecycle.DefaultLifecycleObserver

Categories

Resources