如何在React Native中进行Facebook登录?

问题描述 投票:0回答:1

我想在我的React Native应用程序中使用Facebook登录。

https://developers.facebook.com/docs/react-native/configure-android我使用了此文档,但是在完成此步骤后运行react-native run-android代码时。我面对

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

此错误。尝试过gradlew clean,但未运行

android reactjs react-native facebook-sdk-4.0
1个回答
0
投票

[如果您只想用Facebook登录,则此包是您想要的https://github.com/facebook/react-native-fbsdk,如果您使用firebase登录,则此https://github.com/invertase/react-native-firebase/tree/master/packages/auth

同样,如果您的react native项目使用的是android 10,您的错误是因为multidex:build.gradle

 android {
        defaultConfig {
            ...
            minSdkVersion 15
            targetSdkVersion 28
            multiDexEnabled true
        }
        ...
    }

    dependencies {
      implementation 'com.android.support:multidex:1.0.3' // android < 10
      implementation 'androidx.multidex:multidex:2.0.1' // android 10
    }

manifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.myapp">
        <application
                android:name="android.support.multidex.MultiDexApplication" >
            ...
        </application>
    </manifest>

MainAplication.java

    public class MyApplication extends MultiDexApplication { ... }

© www.soinside.com 2019 - 2024. All rights reserved.