1. 程式人生 > >React-Native錯誤記錄

React-Native錯誤記錄

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