我在react native中遇到了从应用程序获取apk的问题



首先,我进入项目主文件夹中的android文件夹并执行以下命令

sudo  ./gradlew clean

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See 
https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 2s
12 actionable tasks: 12 executed

然后我做了下面的事情,但我不能得到我的apk

sudo ./gradlew assembleRelease
> Task :react-native-community_async-storage:compileReleaseJavaWithJavac
Note: /Users/erfanesfahanian/Desktop/react project/Test/node_modules/@react-native- 
community/async- 
storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java 
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-fs:compileReleaseJavaWithJavac
Note: /Users/erfanesfahanian/Desktop/react project/Test/node_modules/react-native- 
fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-gesture-handler:compileReleaseJavaWithJavac
Note: /Users/erfanesfahanian/Desktop/react project/Test/node_modules/react-native-gesture- 

handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :react-native-image-crop-picker:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-reanimated:compileReleaseJavaWithJavac
Note: /Users/erfanesfahanian/Desktop/react project/Test/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/erfanesfahanian/Desktop/react project/Test/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: resolve_projpath: path `/Users/erfanesfahanian/Desktop/react project/Test`: open: /Users/erfanesfahanian/Desktop/react project/Test: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
Welcome to React Native!
Learn once, write anywhere

events.js:287
throw er; // Unhandled 'error' event
^
Error: resolve_projpath: path `/Users/erfanesfahanian/Desktop/react project/Test`: open: /Users/erfanesfahanian/Desktop/react project/Test: Operation not permitted
at BunserBuf.<anonymous> (/Users/erfanesfahanian/Desktop/react project/Test/node_modules/fb-watchman/index.js:95:23)
at BunserBuf.emit (events.js:310:20)
at BunserBuf.process (/Users/erfanesfahanian/Desktop/react project/Test/node_modules/bser/index.js:292:10)
at /Users/erfanesfahanian/Desktop/react project/Test/node_modules/bser/index.js:247:12
at processTicksAndRejections (internal/process/task_queues.js:79:11)
Emitted 'error' event on WatchmanWatcher instance at:
at Client.<anonymous> (/Users/erfanesfahanian/Desktop/react project/Test/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:130:10)
at Client.emit (events.js:310:20)
at BunserBuf.<anonymous> (/Users/erfanesfahanian/Desktop/react project/Test/node_modules/fb-watchman/index.js:107:12)
at BunserBuf.emit (events.js:310:20)
at /Users/erfanesfahanian/Desktop/react project/Test/node_modules/bser/index.js:249:12
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
watchmanResponse: {
error: 'resolve_projpath: path `/Users/erfanesfahanian/Desktop/react project/Test`: open: /Users/erfanesfahanian/Desktop/react project/Test: Operation not permitted',
version: '4.9.0'
}
}
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'npx'' finished with non-zero exit value 1
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 9s
109 actionable tasks: 109 executed

我不知道该怎么办。当我运行此任务时,我的代码配置为100%执行go直到73%错误就这样发生了。我认为我自己的错误来源是从项目中导入的东西的警告,我的笔记本电脑操作系统是OSX

错误堆栈很容易混淆,并且没有指出问题的真正原因,可能有多种原因。但您可以尝试以下操作:

  • 在生成生成时检查metro生成器是否正在运行。如果没有,你可以从你的根目录作为";react native start">
  • 如果metro生成器正在运行,请确保没有其他Node进程在同一端口上运行
  • 我建议您将您的父目录重命名为"dir";react项目;到一些没有空间的东西,比如";react_project";。我是根据语句Error: resolve_projpath: path [...]猜测的。此外,建议使用不带空格的目录结构名称,这可能会导致命令操作失败
  • 根据语句error: 'resolve_projpath: path/Users/erfanesfahanian/Desktop/react-project/Test-: open: /Users/erfanesfahanian/Desktop/react project/Test: Operation not permitted',,我认为您应该检查/更改处理项目的目录的权限。要进行验证,请使用android Studio(管理员访问(打开android目录,然后从那里构建您的项目,如果成功编译,则必须存在权限问题

相关内容

  • 没有找到相关文章

最新更新