unable to load script from assets 'index.android bundle'

來源:互聯網
上載者:User

標籤:android   總結   tool   ase   一個   lib   roi   asc   nbsp   

在Android手機上運行React-native項目時

報錯:unable to load script from assets ‘index.android bundle‘  ,make sure your bundle is packaged correctly or youu‘re runing a packager server

 

 

解決方案:

第一步:在  android/app/src/main 目錄下建立一個  assets空檔案夾

第二步:執行 下面這段命令

 
  1. 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/  

會發現 assets檔案夾下多出兩個檔案

 

第三步:重新run程式。

 

總結:

這個index.android.bundle毫無疑問就是用來調用原生控制項的js指令碼,每次當你改變了 index.android.js,你都需要使用上面的程式碼片段,來及時的更新index.android.bundle,然後打包才可以把新的index.android.js應用上,所以當沒有index.android.bundle檔案時,RN是無法啟動並執行.

 

see:  http://blog.csdn.net/u014175342/article/details/73823904

unable to load script from assets 'index.android bundle'

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.