Skip to content
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

Android: App freeze if combined with @capacitor-community/stripe #114

Open
crashWunderdog opened this issue Nov 21, 2022 · 12 comments
Open

Comments

@crashWunderdog
Copy link

Describe the bug
Facebook-login package causes application to freeze on android device if @capacitor-community/stripe package is included in the project. The facebook login view will open, but when it is closed (either by successfull login or user aborting the login session) the application stops responding.
Issue does not happen on browser (I have not tested iOS).

To Reproduce
Steps to reproduce the behavior:

  1. Create a new React CRA project and add Capacitor (official docs: https://capacitorjs.com/solution/react)
  2. Install @capacitor-community/facebook-login by following the instructions on read me and create a simple page for the login. At this point the login should work without any issues.
  3. Add @capacitor-community/stripe plugin to the project and configure it by the instructions on readme.
  4. Now the facebook login freezez the whole application every time the login dialog is closed.

Expected behavior
The login should work as it did without the stripe-plugin and application should not freeze.

Smartphone (please complete the following information):

  • OS: Android (iOS not tested).
  • Version Pixel 6 API 33 (tested on a couple of other devices also, all have the same problem)

Additional context
I can not see any direct error messages is the logs that could indicate the cause of the issue, the application just fully stops responding.
Package versions used:

"@capacitor-community/facebook-login": "4.0.0",
"@capacitor-community/stripe": "4.1.0",
"@capacitor/android": "4.4.0",
"@capacitor/app": "4.0.1",
"@capacitor/core": "4.4.0",
"@capacitor/cli": "4.4.0",

android/app/src/main/java/**/**/MainActivity.java:

package com.myapp.app;

import com.getcapacitor.Plugin;
import java.util.ArrayList;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.community.facebooklogin.FacebookLogin;
import com.getcapacitor.community.stripe.StripePlugin;


public class MainActivity extends BridgeActivity {
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        registerPlugin(com.getcapacitor.community.stripe.StripePlugin.class);
        registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
    }
}
@ciccilleju
Copy link

ciccilleju commented Nov 22, 2022

i'm using it with capacitor stripe but i'm not facing this issue

this is my MainActivity.java
`
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;

public class MainActivity extends BridgeActivity {
@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
registerPlugin(com.getcapacitor.community.stripe.StripePlugin.class);
}
}
`

i don't think you must specify all those imports

import com.getcapacitor.Plugin; import java.util.ArrayList; import android.os.Bundle; import com.getcapacitor.BridgeActivity; import com.getcapacitor.community.facebooklogin.FacebookLogin; import com.getcapacitor.community.stripe.StripePlugin;

i think

import android.os.Bundle;
and
import com.getcapacitor.BridgeActivity
are enough

@crashWunderdog
Copy link
Author

@ciccilleju you seem to be right, the build process works without those imports also. But unfortunately that does not fix the issue 😞
I have created a minimal repo for reproducing the issue, any chance you could check it and see if there is something different from your setup? Thanks 🙌
https://github.com/crashWunderdog/capacitor-fb-stripe-demo

@ciccilleju
Copy link

my app runs with angular, but i was able to try it anyway.
it doesn't freeze, i can get a facebook response and then call it again and again
image

@crashWunderdog
Copy link
Author

crashWunderdog commented Nov 22, 2022

@ciccilleju Just to make sure, did you test this with android? For me it works on browser, but on android the app freezes. Im am creating the build with gradlew assembleDebug / gradlew assembleRelease (for complete example, see build:android command in package.json) and the issue happens both on emulator (tried multiple different models / apis) and on actual android device 🤔

@ciccilleju
Copy link

tried with android studio and my device, a samsung s20

try using Android Studio

@crashWunderdog
Copy link
Author

crashWunderdog commented Nov 22, 2022

@ciccilleju thanks, I can try to give it a try later 👍 Ofc I still need to find a actual fix for this issue to be able to build .apk release file and distribute the application, but if the build actually works this way ,then I guess the issue could be related to the gradle version or something like that? 🤔 Unfortunately I dont have too much detailed experience with the android build process.

EDIT: Tested building the app directly from android studio, no luck 😞 Could you check the Gradle version you are using?
You can see it with cmd + ; for Mac or Ctrl + Alt + Shift + S in Windows. Im using the Android Gradle Plugin version 7.2.1 and Gradle version 7.4.2.

@ciccilleju
Copy link

image

@ciccilleju
Copy link

have you tried to uninstall the latest vesrion 4.0.0-1 of facebook plugin?

@crashWunderdog
Copy link
Author

Tried with the same Gradle versions and facebook login V4.0.0-1, no luck 😞

@rgarciadelongoria
Copy link

Hello, I'm the same.

It enters FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS }); but if I close the browser or finish the login it returns to the App and it stays frozen. It only continues execution when I press the back native button.

I can see a visual glitch when I press the back button.

@rgarciadelongoria
Copy link

I solved my issue upgrading the version of sdk-android-facebook on build.gradle, I made a PR for this issue

@rgarciadelongoria
Copy link

@crashWunderdog try again with the new versión 5.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants