Android studio 运行RN项目

来源:16-3 React Native 混合开发实战(Android篇)-1【解锁新的开发方式】

慕娘0391735

2019-08-27

老师,问您一个在Android studio 运行RN项目的问题,因为要调试一些原生的Android代码,
项目现在直接运行 react-native run-android是成功的,然后在Android studio里面运行我是先把项目中的android导入进Android studio,然后通过cmd在项目根目录下运行react-native start,然后在Android stduio中运行,报错
cmd控制台:
Loading dependency graph, done.
events.js:174
throw er; // Unhandled ‘error’ event
^

Error: EPERM: operation not permitted, lstat 'D:\WorkPlace\ReactNative\react_native\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\arch\core’
Emitted ‘error’ event at:
at NodeWatcher. (D:\WorkPlace\ReactNative\react_native\node_modules\sane\src\node_watcher.js:291:16)
at callback (D:\WorkPlace\ReactNative\react_native\node_modules\graceful-fs\polyfills.js:295:20)
at FSReqWrap.oncomplete (fs.js:153:21)
图片描述
Android控制台:
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
at org.gradle.initialization.DefaultGradleLauncherExecuteTasks.run(DefaultGradleLauncher.java:386)atorg.gradle.internal.operations.DefaultBuildOperationExecutorExecuteTasks.run(DefaultGradleLauncher.java:386) at org.gradle.internal.operations.DefaultBuildOperationExecutorExecuteTasks.run(DefaultGradleLauncher.java:386)atorg.gradle.internal.operations.DefaultBuildOperationExecutorRunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at

图片描述

写回答

1回答

CrazyCodeBoy

2019-08-28

将终端关闭,直接通过Android studio的运行按钮运行,理论上它会自动启动RN的本地服务

0
0

RN入门到进阶,打造高质量上线App

解锁React Native开发应用新姿势,React Native新版本热门技术

3144 学习 · 3241 问题

查看课程