【问题标题】:Error Attempted to use a firebase module that's not installed on your Android project by callign firebase.app()错误尝试通过 callign firebase.app() 使用未安装在您的 Android 项目上的 firebase 模块
【发布时间】:2021-05-27 20:37:59
【问题描述】:

我想在我的应用中使用 firebase 身份验证。在将所有文件配置到并在 Expo 上运行后,它给了我上述错误。

我的 authProvider 文件:

import React, { createContext, useState} from "react"
import auth from "@react-native-firebase/auth"


export const AuthContext = createContext();

export const AuthProvider = ({children}) => {
    const [user, setUser] = useState(null);
    return (

        <AuthContext.Provider
        value={{
            user, 
            setUser,
            login: async (email, password) => {
                try{
                   await auth().signInWithEmailAndPassword(email, password);
                    
                }catch(e) {
                    console.log(e)
                }
            }, 
            register: async (email, password) => {
                try{
                    await auth().createUserWithEmailAndPassword(email, password);
                }catch(e){
                    console.log(e)
                }
            }, 
            logout: async() => {
                try{
                    await auth().signOut()
                } catch(e){
                    console.log(e)
                }
            }
        }}
        >
            {children}
            
        </AuthContext.Provider>
    )
}

我的android file

【问题讨论】:

    标签: javascript android firebase react-native firebase-authentication


    【解决方案1】:

    如果您运行此脚本,它将生成一个模板,您可以将其与您的文件进行比较(android/build.gradle / android/app/build.gradle / package.json etc)

    https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

    【讨论】:

      猜你喜欢
      • 2022-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      • 2020-03-12
      相关资源
      最近更新 更多