错误:找不到本机模块“ExpoLocalAuthentication”,js引擎:hermes

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

我在尝试使用后遇到此错误

expo-local-authentication

This is my app.json

{
  "expo": {
    "name": "gctimes_app",
    "slug": "gctimes_app",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "googleServicesFile": "./google-services.json",
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      "package": "com.example.example_app"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "extra": {
      "eas": {
        "projectId": "project_id"
      }
    }
  }
}

这是我的package.json

{
  "name": "gctimes_app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-firebase/analytics": "^18.5.0",
    "@react-native-firebase/app": "^18.5.0",
    "@react-native-firebase/messaging": "^18.5.0",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/stack": "^6.3.17",
    "axios": "^1.5.0",
    "base-64": "^1.0.0",
    "expo": "~49.0.8",
    "expo-dev-client": "~2.4.11",
    "expo-font": "^11.4.0",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "i18next": "^23.5.1",
    "react": "18.2.0",
    "react-i18next": "^13.2.2",
    "react-native": "0.72.4",
    "react-native-date-picker": "^4.3.3",
    "react-native-date-ranges": "^2.5.0",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-paper": "^5.10.6",
    "react-native-reanimated": "^3.5.2",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-table-component": "^1.2.2",
    "react-native-vector-icons": "^10.0.0",
    "uuid": "^9.0.1",
    "expo-local-authentication": "~13.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

我在使用 expo 构建开发版本并在我的物理设备上运行它之后尝试它。

我也尝试过构建一个新的版本,但在运行 gradlew 期间遇到此错误

评估项目“:expo-local-authentication”时出现问题。

[标准错误]

无法为 org.gradle.api.tasks.bundling.Jar 类型的任务“:expo-local-authentication:androidSourcesJar”设置未知属性“分类器”。

react-native expo
1个回答
0
投票

重建前需要将插件添加到app.json中

{
  "expo": {
    "plugins": [
      [
        "expo-local-authentication",
        {
          "faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID."
        }
      ]
    ]
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.