1. run-android时报错:
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and
have set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
这个找了半天问题,最后发现是Ubuntu的运行权限问题。
需要设置 chmod 755 android/gradlew 给gradlew运行的权限。
链接: https://blog.csdn.net/u011516241/article/details/79796059
2. 解决上一个问题后又报了一个错误:
Could not get unknown property 'MYAPP_RELEASE_STORE_FILE' for SigningConfig_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=null, v1SigningEnabled=true, v2SigningEnabled=true} of type com.android.build.gradle.internal.dsl.SigningConfig
这个错误是有gradle的相关配置文件没有。
原因:
按照官网指示
编辑~/.gradle/gradle.properties(没有这个文件你就创建一个),添加如下的代码(注意把其中的替换为相应密码)
解决方法:
gradle.properties文件应该使用RNProject/android/下面的gradle.properties
也就是说在gradle.properties里面添加
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=*
MYAPP_RELEASE_KEY_PASSWORD=*
链接: https://blog.csdn.net/u011516241/article/details/79796059
3. Watchman报错:jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
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: A non-recoverable condition has triggered. Watchman needs your help!
The triggering condition was at timestamp=1545541721: inotify-add-watch(/home/huqiong/develop/reactNative/testDemo/node_modules/react-native-vector-icons/android/build/generated/source/r/debug/com) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem. You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
解决办法: https://stackoverflow.com/questions/42711008/error-when-running-watchman
设置:
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
在运行:
watchman shutdown-server
参考的博客文章连接:
https://blog.csdn.net/u011516241/article/details/79796059
https://blog.csdn.net/greekmrzzj/article/details/79394537
https://stackoverflow.com/questions/42711008/error-when-running-watchman