android - 运行反应本机应用程序时出错
问题描述
我正在安装 react native,同时在 windows 中的 react native android 中运行我的第一个应用程序。我收到错误
无法确定任务 ':app:preDebugBuild' 的依赖关系。> 无法解析配置 ':app:debugRuntimeClasspath' 的所有任务依赖项。> 无法解析项目:react-native-default-preference。要求:项目:应用程序>无法找到项目的匹配配置:react-native-default-preference:所有消耗性配置都没有属性。在本机反应
解决方案
您应该清除缓存并重试
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ &&
npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* &&
rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm
install && npm start -- --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ &&
npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del
node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
答案来自https://gist.github.com/jarretmoses/c2e4786fd342b3444f3bc6beff32098d
推荐阅读
- haskell - 混合 Parser Char (lexer?) 与 Parser String
- python - python的基本部分苦苦挣扎(检查变量是否等于输入)
- php - 如何在不访问 Laravel (PHP) 中的网络的情况下更新表格?
- r - 试图弄清楚如何分解文本文件
- php - 输出 PHP 字符串以显示转义字符
- mysql - 将两个 MySQL 表与关注者相关联
- r - 叠加图:时间序列 - 不同频率(条上的线)[ggplot2]
- c - 在不排序的情况下查找数组中的第二大元素
- postcss - postcss-normalize 覆盖了我自己的样式
- makefile - 将环境变量从 Makefile 导出到用户态环境