Nubescope / react-native-facebook-account-kit

Facebook Account Kit SDK wrapper for React Native
321 stars 120 forks source link

[Android] App crashes when call to loginWithEmail/Phone #158

Closed danhnguyeen closed 5 years ago

danhnguyeen commented 5 years ago

Hey Guy! Please help me to fix my issue

Issue Description

I installed and linked React Native Account Kit to my project. After fixed some issues, my app can start now. But when i try to call to the loginWithEmail/Phone function, my app is crashed and auto closed. Could you help me please? Thank in advance!

app/build.gradle dependencies { implementation project(':react-native-facebook-account-kit') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:23.0.1" implementation "com.facebook.react:react-native:+" implementation project(':react-native-maps') implementation project(':react-native-splash-screen') implementation project(':react-native-linear-gradient') implementation project(':react-native-i18n') implementation project(':react-native-vector-icons') implementation project(':react-native-fcm') implementation 'com.google.firebase:firebase-core' implementation 'com.google.firebase:firebase-messaging' }

build.gradle ext { buildToolsVersion = "27.0.3" minSdkVersion = 16 compileSdkVersion = 27 targetSdkVersion = 27 supportLibVersion = "26.1.0" googlePlayServicesVersion = "15.0.1" androidMapsUtilsVersion = "0.5+" }

Additional Information

jpgarcia commented 5 years ago

Hi @danhnguyeen we need the logs to see what is happening. Could you please run adb logcat when launching the app or get the logs from Android Studio? and post here the output?

danhnguyeen commented 5 years ago

Hi @jpgarcia , thanks for you fast reply. I tried adb logcat, but i'm not sure it's useful. Because when the app is crashed, it doesn't log anything

10-02 17:59:57.425 9727 9727 E AndroidRuntime: FATAL EXCEPTION: main 10-02 17:59:57.425 9727 9727 E AndroidRuntime: Process: com.mylife_app, PID: 9727 10-02 17:59:57.425 9727 9727 E AndroidRuntime: java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.mylife_app-1/base.apk) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:81) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:71) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:865) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:525) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at com.facebook.accountkit.ui.TitleFragmentFactory$TitleFragment.createView(TitleFragmentFactory.java:87) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at com.facebook.accountkit.ui.LoginFragment.onCreateView(LoginFragment.java:43) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at com.facebook.accountkit.ui.TitleFragmentFactory$TitleFragment.onCreateView(TitleFragmentFactory.java:50) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.Fragment.performCreateView(Fragment.java:2352) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.BackStackRecord.run(BackStackRecord.java:815) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1582) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.FragmentController.execPendingActions(FragmentController.java:372) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.Activity.performResume(Activity.java:7145) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3821) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3885) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread.-wrap14(ActivityThread.java) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6776) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) 10-02 17:59:57.425 9727 9727 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

danhnguyeen commented 5 years ago

@jpgarcia ah sorry, i have just re-edit the logcat

jpgarcia commented 5 years ago

Not really sure but It seems there's a conflict with the supportLibVersion... did you try upgrading it to 27.1.1?

danhnguyeen commented 5 years ago

yes, that is exactly what i think. i think there are some conflict versions. i tried 27.1.1, but still same problem :(

jpgarcia commented 5 years ago

Sorry to hear that 😞 Maybe if you create a sample in a public repo with the issue, I can help you to troubleshoot the issue...

jpgarcia commented 5 years ago

You can also try by overriding the dependencies as I mentioned in this issue to workaround firebase dependencies using resolutionStrategy.

danhnguyeen commented 5 years ago

@jpgarcia i have just public my repo. if you have time, can you help me please. Really big thanks for that

jpgarcia commented 5 years ago

I tried the branch you mentioned but the application bundle is throwing errors. Could you please check that? maybe you forgot to commit something.

Error: Unable to resolve module `./BookingData` from `~/mylife-app-v2/src/components/BookTable/TabBooking/BookingForm/index.js`: The module `./BookingData` could not be found from `~/mylife-app-v2/src/components/BookTable/TabBooking/BookingForm/index.js`. Indeed, none of these files exist:
danhnguyeen commented 5 years ago

ah yes, the reason is Git doesn't update when i rename the files from lowercase to uppercase. i have just disabled that modules. Could you re-pull the repo please

jpgarcia commented 5 years ago

didn't work... please make sure that is working by cleaning it up and run it again...

danhnguyeen commented 5 years ago

sorry for that. Because it's working on my computer, so there is a bit difficult to test i have just renamed the files same with Git repo. it should be ok now

jpgarcia commented 5 years ago

Hey @danhnguyeen just got your app working with account kit by adding the following dependency to the dependencies section in android/app/build.gradle file.

implementation "com.android.support:design:27.1.0"

Let me know if it did the trick so I can close this one.

danhnguyeen commented 5 years ago

My god, it's worked perfectly. Your support is really saved my time too much. Big thanks for your support. Wish all the best for you, @jpgarcia

bijoycse commented 5 years ago

I have solved it by simply down grade the version of react-native-facebook-account-kit as well as add implementation "com.android.support:design:27.1.0"

before : "react-native-facebook-account-kit": "^1.0.2"

now : "react-native": "0.57.8", "react-native-facebook-account-kit": "^0.11.0", "react-native-firebase": "^5.1.0"

its working now along with triangle integration 1. react-native-maps 2. react-native-fire-base 3. react-native-facebook-account-kit

phanbien9x commented 5 years ago

@bijoycse Can you create release apk? I follow your recommend but when release it not work. My logcat:

D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\compiled\release\values_values.arsc.flat\
          -R\
          D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\compiled\release\xml_preferences.xml.flat\
          --auto-add-overlay\
          --non-final-ids\
          -0\
          apk\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

And this is gradle scan error

The :react-native-facebook-account-kit:verifyReleaseResources task failed.View task in console log
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output:  D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\merged\release\values\values.xml:1254: error: resource android:attr/fontVariationSettings not found.
D:\WORKSPACE\REACT_PROJECT\vtgo_owner\VTGO\node_modules\react-native-facebook-account-kit\android\build\intermediates\res\merged\release\values\values.xml:1255: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Because it too long so I can't show all of this. -_

bijoycse commented 5 years ago

@phanbien9x I have create my apk after adding below lines.. Please add this line android/build.gradle

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27     //do this in android/app/build.gradle too
                buildToolsVersion '27.0.3'  //do this in android/app/build.gradle too
            }
        }
    }
}
phanbien9x commented 5 years ago

It doesn't work. My error still happens. Is react-native-firebase have cloud messaging? Should I change react-native-fcm to react-native-firebase @bijoycse Did you try #157 solution. I don't know how to implement that!

bijoycse commented 5 years ago

@phanbien9x Yes i use react-native-firebase so please go through and this link and implement.

phanbien9x commented 5 years ago

Thank you @bijoycse. I tried but it hard to implement!

bijoycse commented 5 years ago

@phanbien9x Yes i use react-native-firebase so please go through and this link and implement.