-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on release build in Android 11 #138
Comments
This is from the facebook documentation. To avoid a disrupted user experience, please use the following checklist: |
|
I have updated flutter_facebook_auth to |
This plugin does not start an activity maybe the facebook sdk on Android has this functionality so the issue is from the native sdk, in that case if we need to add some extra code in this plugin (Android side) please add a documentation of facebook or any other source related with this |
@darwin-morocho Can we bubble up the exception by the SDK from method channel to the app? So we can handle the error by ourselves because right now it just crashes the app. I tried using try catch block but I think error is not bubbling up into the dart code. |
If the app is working fine in debug mode maybe the problem is your release key hash in the console or any missing configuration in the Facebook developers console. Actually the plataform channels catch all events and errors according to Facebook documentacion. Unfortunally i don't have an Android 11 device to replicate the problem because I use a mac with M1 chip |
Actually the app crashes in mi phones most of the time, works good on Samsung |
according to your medium link you must add the queries for the Facebook app adding the Facebook package name or you can use loginBehavior parameter in the login method and use default falkback or webview when you app is running Android 11 or higher |
@itssidhere Yes same point it in release mode it only works on samsung. |
It seems a breaking change in the Facebook sdk on Android please check the documentation https://developers.facebook.com/docs/facebook-login/android/deprecating-webviews let me know if doing the changes in this documentation fix the problem |
@darwin-morocho I tried that already but that doesn't seems to work |
Please add your android manifest and your dart code. Also add your MainActivty and your build.gradle |
After check a similar issue on react native thebergamo/react-native-fbsdk-next#64 (comment) it seems a problem with FlutterActivity so can you try this software-mansion/react-native-screens#17 (comment) |
Manifest looks like this , though i have tried commenting customtab acitivity still no luck
MainActivity
Build.gradle
Dart code
|
Now it works fine for me I add a release hash key and my problem was that Facebook doesn't return the email parameter always for all users so it crashes on value["email"] adding ( value["email"] ?? value["id"]+"@facebook.com" ) solve my problem and it's working fine now |
You have 2 problems. First you have firebase messaging in your build.gradle that is not need it because that dependency is included in firebase_messagin. the second problem is your MainActivity extends of flutterfragmentactivity so you need to override the oncreate method an call to super.onCreate to keep the app activity state after resume here one example https://pub.dev/packages/local_auth |
@darwin-morocho onCreate method is deprecated isn't it? |
no. is not deprecated |
Have you tested in device with Android 11? |
maybe is deprecated but what you are using FlutterFragmentActivity? |
@darwin-morocho for local auth |
if you are using java according to local auth documentation you need onCreate |
Actually, their documentation was outdated I had a hard time with that too. Let me add onCreate and update you?? |
yes use onCreate please or try to use FlutterActivity and test the. login with facebook if the login works with FlutterActivity you need to check your MainActivity and this is not a bug of this plugin and this issue should be closed |
I added this line
I do agree with you that this is an issue of the underlying plugin but it should be kept open to discuss the workaround as more people encounter it they will create separate issues. Maybe we can come to a solution here. |
if the problem was fixed with onCreate method I will add this to the documentation |
@darwin-morocho I tested it and it's the same. I am trying to pass null to the super method call of onCreate as suggested by the react-native solution. I will update you |
@darwin-morocho still no luck |
@darwin-morocho still same |
I have tried to reproduce the issue installing local_auth and running the app in release mode with a HUAWEI with android 10 and everything is ok |
please try this apk and let me know if the app crashes |
@darwin-morocho How did you manage to fix it? |
nothing special just I have added the release key hash in the Facebook developers console and I have changed the app to production in the console . And also to generate this hash I used mac os |
My app is signed by google play store so I had to manually convert the sha1 to base64 . It works on every device except mine. But your app works on mine too |
this app uses flutter Facebook auth https://play.google.com/store/apps/details?id=app.meedu.app can you install it and check if the problem persists |
@darwin-morocho This app also works fine in my phone |
Google play console creates 2 sha1. Have you added both in your Facebook developers console? |
@darwin-morocho yes |
in that case maybe your MainActivity is locking the Facebook sdk |
Can you send me your MainActivity so that I can try to replicate it. I have also overriden Application java from mainfest can that be an issue as well |
just check the example folder of this repo |
Still no luck |
Have you tried creating a release keystore and creating the hash and next create a release apk using this keystore? also you need to add this hash in the facebook developers console |
@darwin-morocho its working now with that method! |
it seems a problem with your hash from google play console |
Then why is it working on some devices but not all? Also can you tell me how you created the key from google play console sha1? |
It started working randomly for no reason with play store download also!! |
I don't know why is not working is some devices. |
@darwin-morocho After I deleted the playstore hash from facebook, it started working on playstore release also |
I am not sure why is working now some times facebook developers console works with unexpected behavior |
ensure uninstall the app and install it again from google play if its working the problem is fixed and you should close the issue |
So the solution is to use the upload key certificate from playstore. Thanks I can now close the issue |
The weird thing is it started happening again and to resolve it. I had to install the apk signed from my local machine then reinstall the playstore one. @darwin-morocho |
ahmed770750927ahmedkol |
Bh |
Hello, the plugin works well in debug mode but after trying it out on release mode I get this error.
The text was updated successfully, but these errors were encountered: