React Native中的react-native run-android

时间:2017-07-31 12:18:54

标签: 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 ...
我该怎么办?

2 个答案:

答案 0 :(得分:1)

试试这个:

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

现在通过cd ..

返回项目文件夹

然后react-native run-android

答案 1 :(得分:0)

自动方法

./android/gradlew clean(在win cmd中移除./)

手动方法

android/buildandroid/app/build

中删除构建文件