4

I have just compiled the AOSP and copied system.img to Android SDK directory on Windows. But the emulator can't boot the virtual device. Anyone knows why?

iBug
  • 35,554
  • 7
  • 89
  • 134
Jack zhang
  • 41
  • 1
  • 3
  • xdescription "But the emulator can't boot the virtual device" is not enough to provide any good answer short and too general answer is "follow instruction from https://source.android.com/setup/build/building " > Emulate an Android device The emulator is added to your path automatically by the build process. To run the emulator, type: emulator also try use linux instead of Windows – Tolik Odukha Jan 14 '19 at 17:53
  • Here is a detailed working setup: https://stackoverflow.com/questions/1809774/how-to-compile-the-android-aosp-kernel-and-test-it-with-the-android-emulator/48310014#48310014 – Ciro Santilli OurBigBook.com Jan 30 '19 at 17:48

1 Answers1

4

Build ASOP and run on emulator

Build an AVD system image. This is the same process as building an Android device system image. For example, to build a x86 (Check this)

$ cd aosp-master
$source ./build/envsetup.sh
$ lunch sdk_phone_x86
$ make -j32

$ make -j32 sdk sdk_repo

$ cd ./out/host/linux-x86/sdk/sdk_phone_x86

You can see the build system images zip file as follows

$ ls

sdk-repo-linux-system-images-eng.[username].zip

extract the above zip

you can add to . ~/.bashrc or just type on terminal

$ export ANDROID_SDK=<Path_to_SDK>
$ export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH

go to extracted folder

$ cd <extracted 
sdk-repo-linux-system-images-eng.[username]>

you can see image files in folder(./x86)

Create AVD by android studio. Go to Android Studio-> tools-> avd manager->create virtual device lets say we created Pixel_2_API_29

check available android virtual devices

$ emulator -list-avds

Pixel_2_API_29

then run build ASOP images on emulator

$ emulator -sysdir <Path_to_images> -avd <Created_AVD>

ex:

$emulator -sysdir <Patth_To_Extracted_Images/x86> -avd Pixel_2_API_29
Hiranya
  • 94
  • 4