从源代码构建 Android 后运行模拟器 [英] Running emulator after building Android from source

查看:40
本文介绍了从源代码构建 Android 后运行模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够将最新的 android 源代码下载到 32 位 Ubuntu 虚拟机中(主机:Windows 7 64 位).构建完成且没有任何错误.

I am able to pull down the latest android source code into a Ubuntu virtual machine 32-bit (Host: Windows 7 64-bit). The build completes without any errors.

然后我尝试按照这些说明,其中提到我应该运行我的源代码根目录上的模拟器.但是,当我尝试这样做时,我收到一条错误消息,指出找不到此命令.

Then I tried to follow these instructions, where it mentions that I should run the emulator on the root of my source code. However, when I tried that, I get an error stating that this command is not found.

所以我去了out/host/linux-x86/bin文件夹,我发现emulator*有几个文件:

So I went to the folder out/host/linux-x86/bin and I found out that there are couple files for emulator*:

  • 模拟器
  • emulator-arm
  • emulator_renderer
  • emulator-ui
  • emulator-x86

当我在这里输入 emulatoremulator-x86 时,它也不起作用.这是我得到的错误:

When I typed the emulator and emulator-x86 here, it also doesn't work. Here is the error I'm getting:

xxxx/out/host/linux-x86/bin$ ./emulator-x86
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.

If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).

Otherwise, follow the instructions in -help-disk-images to start the emulator

所以当我运行 ./emulator-x86 -help-disk-images 时,我看到以下内容:

So when I run ./emulator-x86 -help-disk-images, I see the following:

If you are building from the Android build system, you should
have ANDROID_PRODUCT_OUT defined in your environment, and the
emulator shall be able to pick-up the right image files automatically.
See -help-build-images for more details.

我自己构建了这个,所以我认为 ANDROID_PRODUCT_OUT 是在我的环境变量中设置的,但我没有看到它.所以我认为我应该运行一些其他的 shell 脚本来获得该设置.

I built this myself, so I would think that ANDROID_PRODUCT_OUT is set in my environment variables, but I don't see it. So I think that I should run some other shell script to get that set.

我查看了 img 文件,我在 out/target/product/generic 位置看到了一对:

I looked at the img files, I saw couple at the location out/target/product/generic:

  • ramdisk.img
  • system.img
  • userdata.img

有人可以对此有所了解并帮助我下一步该怎么做吗?我是 Android 新手,对此进行了一些研究,但找不到任何类似的问题.

Could anyone shed some light on this and assist me on what I should do next? I am new to Android and I did some research on this but I couldn't find any similar issues.

推荐答案

我不知道您为哪个产品进行构建,但要运行模拟器,您可以使用以下命令:

I do not know for which product you do your build but to run emulator you can use the following command:

out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/-system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img-data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-尺寸 1024

out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-size 1024

只需将其复制到 Android 源文件夹根目录中的 .sh 文件中并运行此文件即可.或者你可以直接运行它,但你首先应该 chdir 到你的 Android 源文件夹根目录.

Just copy it into .sh file into the root of your Android source folder and run this file. Or you can just run it but you should chdir to your Android source folder root at first.

并且不要忘记使用命令 mksdcard 在根文件夹中创建一个 sdcard 图像.

And do not forget to create an sdcard image in the root folder with command mksdcard.

这篇关于从源代码构建 Android 后运行模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆