react native踩坑之旅


1. AwesomeProject keeps stopping

在使用安卓模擬器調試react native項目時報錯 “xxx keeps stopping” (xxx,項目名)。

起因是代碼里有一個地方屬性值寫錯了,應該是“space-around”,導致項目運行錯誤,這種情況下,就算改正了,再刷新也還是會報錯。

解決辦法,找到bug並修復這是必須的,然后,你需要重新執行react-native run-android  (必要時在模擬器里卸載app再執行react-native run-android).

2.  React Native unable to load script from assets index.android.bundle on windows

第一步: 在main下建立一個assets文件夾

第二步:在項目根目錄運行cmd執行下面代碼

React-native bundle --platform Android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

最后重新react-native run-android就可以了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM