reactjs - React Native 中的 react-native run-android

标签 reactjs react-native

我是 React Native 语言的新手,我在 Android 中运行该应用程序时遇到了困难。

错误是:

FAILURE: Build failed with an exception.
What went wrong:
 Execution failed for task ':app:processDebugResources'.> 
 java.io.IOException: Could not delete path'C:\Users\Documents\projectFolder\android\app\build\generated\source\r\debug\android\support\graphics\drawable'.

在我的 package.json 中

    "name": "sampleProject",
    "version": "0.1.6",
    "private": true,
    "scripts": {
    "start": "rm -rf __globals__ && cp -fR ../../globals __globals__ && npm run lint && node node_modules/react-native/local-cli/cli.js start",
    "ios": "rm -rf __globals__ && cp -fR ../../globals __globals__ && npm run lint && react-native run-ios",
    "android": "rm -rf __globals__ && cp -fR ../../globals __globals__ && npm run lint && react-native run-android",
    "log-ios": "react-native log-ios",
    "log-android": "react-native log-android",
    "test": "jest",
    "reset": "rm -rf __globals__ && cp -fR ../../globals __globals__ && npm run 
    lint && node node_modules/react-native/local-cli/cli.js start --reset-
    cache",
    "lint": "eslint --fix --max-warnings 1 .",
    "precommit": "npm run lint"
    },
   "dependencies": {
    "async": "~2.4.1",
    "bluebird": "~3.5.0",
    "color-term-console": "~1.0.4",
    "crypto-js": "~3.1.9-1",
    "file-extension": "~3.1.2",
    etc ...

我该怎么办?

最佳答案

试试这个:

使用命令 cd android 转到 android 文件夹,然后运行 ​​./gradlew clean

现在通过 cd .. 回到你的项目文件夹

然后react-native run-android

关于reactjs - React Native 中的 react-native run-android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45415766/

相关文章:

react-native - 多个手势同时响应

javascript - React Native Chart Kit - 条形图颜色从上到下淡出每个条

javascript - React Native - PropTypes.bool 中的 "Cannot read property ' bool' 未定义

javascript - 如何将 props 传递给作为值传递的组件

javascript - 循环中的所有异步调用完成后如何调用函数?

react-native - 如何在react-native中将占位符置于中心

javascript - 在 react 中调用作为 Prop 传递的方法

reactjs - 提取/读取 React propTypes

reactjs - 开 Jest 测试一个 React 类方法被 componentWillMount 调用

reactjs - 在react-mapbox-gl中从GeoJSON绘制多边形