AOSP x86_64 Emulator not visible in Android Studio

狂风中的少年 提交于 2020-08-24 08:18:27

问题


I am using AOSP emulator for testing my code. I downloaded the android10_release source code of AOSP in my pc. Then used the following commands

source build/envsetup.sh

set_stuff_for_environment

lunch aosp_x86_64-eng

make -j6

emulator

now after running these commands I am successfully able to run emulator in my pc OS of my pc is Ubuntu 18.04 I also installed many libraries for working with AOSP like jdk-8, python, curl, repo, git, and other stuff as per described in AOSP website

I am abe to see my emulator running in terminal by executing following commands

$ adb devices

List of devices attached emulator-5554 device

I am also able to install my apk in this emulator by executing following commands

$ adb install myapp.apk

and it gets installed and I can see it in emulator

Now coming to my question

Why this emulator not showing in Android studio in devices Even when I troubleshoot the adb connections in android studio it shows my emulator running but not showing in available devices.


回答1:


Or connect to it via network adb connect localhost:5555 - port number is one higher than emulated device serial (in default case emulator-5554). Then it is visible in Android studio and it works without issues.

solution that works for me (tried on two different machines):

$ 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

waiting for aosp to build

$ 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

start Android Studio (tested with 3.5.3 & 3.6.0)

In the devices list I see: "unknown Android SDK build for x86" with a little green dot next to it.

When I click on Run or Debug everything works




回答2:


Finally after doing a lot of research I got to know that if I want to use Emulator of AOSP in Android Studio so I need to follow this guide Sharing AVD system images for others to use with Android Studio

Follow these instructions to share your AVD system images with others. They can use your AVD system images with Android Studio to develop and test apps.

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.

To use a custom AVD image, do the following in the SDK Manager:

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.

This link is helpful for reference

Create avd from AOSP to use in Android Studio and also share with others



来源:https://stackoverflow.com/questions/60035816/aosp-x86-64-emulator-not-visible-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!