Android Studio 運行 React Native 起步和踩坑

來源:互聯網
上載者:User

標籤:window   rate   could   技術分享   manager   htm   assets   eve   running   

一、參考教程,搭建環境。

教程地址:http://reactnative.cn/docs/0.48/getting-started.html

參考視頻教程,有以下幾點不同:
(視頻教程地址:https://ke.qq.com/webcourse/index.html#course_id=197101&term_id=100233637&taid=1220874518856173&vid=d1417tgg1ez)
1. Chocolatey 不需要安裝。
2. 跳過個人化,直接開啟歡迎介面的配置 Configure -> SDK Manager (也可隨後在軟體介面的 File -> Settings 中開啟)。
只需勾選安裝以下三個選項即可。

 

二、報錯及解決方案1、Your CPU do not support NX. Unfortunately, your computer does not support hardware accelerated virtualization.
在 Android Studio 上啟動模擬器,一直處於啟動狀態。

【解決方案】
新增模擬器時,選擇 Other Images,並且選擇 ABI 為 arm 的(64位系統必須為 arm64)
 

 

2、Unable to load script from assets ‘index.android.bundel‘. Makve sure your bundel is packaged corredtly or you‘re running a packager server.

【可能解決方案】

重新下載程式包(項目主目錄下運行 yarn 命令)

【其他解決方案】
1、(in project directory) mkdir android/app/src/main/assets
2、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
3、react-native run-android
https://stackoverflow.com/questions/44446523/unable-to-load-script-from-assets-index-android-bundle-on-windows
確保以下路徑中有這兩個檔案即可:

 

3、Excecution failde fro task ‘:app:complieDebugJavaWithJavac‘.Could not find tools.jar.

【原因】

在安裝java包時,會遇到兩次直接選取,第一次時選擇jdk的路徑,第二次是選擇jre的路徑,如果所選擇的jdk安裝路徑和jre的安裝路徑相同,那麼jre包中的內容會覆蓋掉jdk中的內容,所以,在你安裝完成之後,會發現找不到tools.jar和dt.jar包。

【解決方案】
在安裝的過程中,jdk和jre要安裝在不同的檔案下,比如jdk安裝在“d:/java/jdk"下面,jre安裝在“d:/java/jre"下面。

 

4、could not connect to development server

 

Android Studio 運行 React Native 起步和踩坑

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.