[英]AOSP x86_64 Emulator not visible in Android Studio
我正在使用 AOSP 模擬器來測試我的代碼。 我在我的電腦上下載了 AOSP 的 android10_release 源代碼。 然后使用以下命令
source build/envsetup.sh
set_stuff_for_environment
lunch aosp_x86_64-eng
make -j6
emulator
現在,在運行這些命令后,我可以成功地在我的 PC 操作系統中運行模擬器 Ubuntu 18.04 我還安裝了許多用於處理 AOSP 的庫,如 jdk-8、python、curl、repo、git 和其他描述的東西在 AOSP 網站上
我將通過執行以下命令來查看我的模擬器在終端中運行
$ adb devices
附加設備列表 emulator-5554 設備
我還可以通過執行以下命令在此模擬器中安裝我的 apk
$ adb install myapp.apk
它被安裝,我可以在模擬器中看到它
現在來回答我的問題
為什么此模擬器未在設備的 Android Studio 中顯示即使我對 android studio 中的 adb 連接進行故障排除,它也會顯示我的模擬器正在運行但未顯示在可用設備中。
或者通過網絡連接到它adb connect localhost:5555
- 端口號比模擬設備的串口號高一個(默認情況下是 emulator-5554)。 然后它在 Android Studio 中可見,並且可以正常工作。
適合我的解決方案(在兩台不同的機器上嘗試過):
$ cd aosp
$ repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r29
...
$ repo sync
...
$ . build/envsetup.sh
$ lunch sdk_phone_x86
$ m -j16
等待 aosp 構建
$ emulator &
$ adb devices
List of devices attached
emulator-5554 device
$ adb connect localhost:5555
connected to localhost:5555
$ adb devices
List of devices attached
emulator-5554 device
localhost:5555 device
啟動 Android Studio(用 3.5.3 & 3.6.0 測試)
在設備列表中,我看到:“未知的 Android SDK build for x86”,旁邊有一個小綠點。
當我點擊運行或調試一切正常
最后,經過大量研究,我知道如果我想在 Android Studio 中使用 AOSP 模擬器,那么我需要按照本指南 共享 AVD 系統映像供其他人與 Android Studio 一起使用
按照這些說明與他人共享您的 AVD 系統映像。 他們可以將您的 AVD 系統映像與 Android Studio 結合使用來開發和測試應用程序。
Make additional sdk and sdk_repo packages:
$ make -j32 sdk sdk_repo
This creates two files under aosp-master/out/host/linux-x86/sdk/sdk_phone_x86:
sdk-repo-linux-system-images-eng.[username].zip
repo-sys-img.xml
Host the file sdk-repo-linux-system-images-eng.[username].zip somewhere accessible to your users, and get its URL to use as the AVD System Image URL.
Edit repo-sys-img.xml accordingly:
Update <sdk:url> to your AVD System Image URL.
See sdk-sys-img-03.xsd to learn about other updates to the file.
Host repo-sys-img.xml somewhere accessible to your users, and get its URL to use as the Custom Update Site URL.
要使用自定義 AVD 映像,請在 SDK 管理器中執行以下操作:
Add the Custom Update Site URL as an SDK Update Site.
This adds your custom AVD system image to the System Images page.
Create an AVD by downloading and selecting the custom AVD system image.
此鏈接有助於參考
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.