gpt4 book ai didi

react-native - React Native - 运行 react-native run-android 时出现异步存储错误

转载 作者:行者123 更新时间:2023-12-04 00:21:13 25 4
gpt4 key购买 nike

我正在尝试运行 react-native run-android 但收到以下错误:

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D:\Work\CS\Wms-Mobile\CS-WmsMobile\node_modules\@react-native-community\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
D:\Work\CS\Wms-Mobile\CS-WmsMobile\node_modules\@react-native-community\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStorageModule.java:34: error: cannot find symbol
@ReactModule(name = AsyncStorageModule.NAME)
^
symbol: class ReactModule
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-community_async-storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 16s

at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (D:\Work\CS\Wms-Mobile\CS-WmsMobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

我尝试过的事情:
  • 重新安装 node_modules
  • cd ./android 然后 ./gradlew clean

  • 但它们似乎都不起作用。很高兴听到你的建议,先谢谢你!

    我的版本:
    react-native-cli: 2.0.1

    react-native: 0.61.4

    android gradle plugin: 3.5.3

    gradle: 5.4.1

    最佳答案

    尝试使用以下命令

    react-native link @react-native-community/async-storage

    随意怀疑

    关于react-native - React Native - 运行 react-native run-android 时出现异步存储错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60510896/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com