Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

編譯 Android 源碼(六):運行編譯後的模擬器

編輯:關於 Android 開發

編譯 Android 源碼(六):運行編譯後的模擬器

完成源碼編譯後,接下來就是啟動模擬器來驗證成果。本文記錄設定環境變數與啟動 emulator 的過程,並附上常見錯誤的排除方法。

一、配置環境變數

將編譯輸出的工具與產品目錄加入環境變數(以下路徑中的 Download/442 為 Android 所在目錄):

export PATH=$PATH:/路徑/out/host/linux-x86/bin
export ANDROID_PRODUCT_OUT=/路徑/out/target/product/generic

二、常見錯誤

直接運行 emulator 時,可能會遇到找不到虛擬裝置的錯誤:

emulator: ERROR: You did not specify a virtual device name,
and the system directory could not be found.

三、解決方法

先載入建置環境並選擇目標,再啟動模擬器:

source build/envsetup.sh
lunch sdk-eng

四、運行 emulator

完成上述設定後,即可成功啟動模擬器。

五、啟動畫面

看到模擬器成功開機並進入桌面,就代表自架的 Android 系統已能正常運行,整個編譯流程至此大功告成。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved