Android-x86 virtual machine installation and configuration online there are many, but all say it really is not much, I hope this article can introduce you to the main configuration to help you take some detours.
paper separately for VMWare and Virtual Box virtual machine introduced two kinds of installation and configuration methods, and describes how to use eclipse for debugging.
First, install Android-x86 virtual machine
1 , use vmware < span lang = "zh-CN"> Install Android-x86
in http: / / www.android-x86.org/download download the installation package, download the eeepc version iso file, in this case to 4.0 RC2 version, for example.
run vmware new virtual machine:
2 , virtual box < span lang = "zh-CN"> Install Android-x86
in Virtual Box to create a new machine:
- target OS (the target OS): Select Linux
- target OS version (the target OS version): others
- I chose to 1GB of memory and a CPU (other options leave the default value)
- add a new hard drive: VDI drive, dynamically sized, 512M
- in storage (storage) option to add a point to the downloaded iso image CDROM
3, start the installation
from the boot (boot) menu, select install to hard disk (installed to the hard disk).
Next create a partition, select new , primary , bootable < span lang = "zh-CN">, write create a bootable primary partition.
next step select yes , where the first two steps to open the GRUB management model can be used to debug procedures.
two, Android-x86 has a built-in shortcut keys
more commonly used are:
- Alt-F1 = Enter console mode
- Alt-F7 = Back to the GUI mode
- Alt-F9 = graphical interface
- Alt-F10 = screen rotated 180 degrees
- Alt-F10 = screen rotated 180 degrees
- Alt-F11 = screen rotated 90 degrees left
- Alt-F12 = screen rotated 90 degrees to
- Ctrl-P = Open Android Settings screen
- "Windows Key" is equivalent to the Android Home button.
- "Esc" is equivalent to Android's Back button
- F2 equivalent to Android's Menu button
- F3 is equivalent to the Android Search button
- right of the menu key ( win and ctrl the middle of the key) = Android Menu key
three, set up a virtual machine network
1 , vmware Settings
a , install the virtual machine requires the use of nat mode
b , if the / data / misc / dhcp directory does not exist, then enter console mode creation
# mkdir /data/misc/dhcp
c , shut down the virtual machine and vmware , modify vmx file
ethernet0.virtualDev = "vlance"
d , open the virtual machine, enter console < / span> mode
# su
# dhcpcd eth0
e , set dns , or set to host the dns consistent address
# setprop net.dns1 8.8.8.8
2 , virtual box < span lang = "zh-CN"> settings:
use bridge mode:
a, using the netcfg command to see whether the device has been assigned eth0 ip address
b, open the virtual machine, use the ALT + F1 to enter the console mode, type su to switch the root user
c, specify the ip address, execute the following script, ip address needs and physical hosts on the same network segment
# ifconfig eth0 192.168.120.200 netmask 255.255.255.0 up
physical host gateway added to the routing table
# route add default gw 192.168.120.254 dev eth0
d, setting dns, or set to the same physical host dns addresses, such as 202.106.196.115
# setprop net.dns1 8.8.8.8
Also important to note is that if the pea pods and other process is active, the network settings will fail, using the netcfg command will find that there is no eth0 device.
So before you install the virtual machine must be stopped pea pods and other software.
If using NAT mode, you need to use the dncpcd automatically assigned ip address, dns and physical hosts to the same example as follows:
# dhcpcd
# ifconfig eth0 up
# setprop net.dns1 202.107.117.11
also need to configure port forwarding
port forwarding can also be physical host virtual box directory, use the following command:
# VBoxManage modifyvm "Your Android VB name" --natpf1 adb,tcp,*,5555,*,5555
3 , so set the long-term effect
in console mode configuration information does not seem to saved, use the following method can guarantee settings remain in effect
# Vi /etc/init.sh
end of the file add the following configuration:
ifconfig eth0 192.168.120.200 netmask 255.255.255.0 up
route add default gw 192.168.120.254 dev eth0
setprop net.dns1 202.106.196.115
four, configure resolution, respectively, analog phones and tablet mobile devices
Virtual box can configure the resolution, vmware < / span> there is no good way, and therefore Virtual box Example.
1, the virtual machine to add a custom resolution
after closing for the virtual machine.
Method One: vbox corresponding virtual machine files "
<ExtraDataItem name="CustomVideoMode1" value="480x800x16"/>
<ExtraDataItem name="CustomVideoMode2" value="320x480x16"/>
Method two: Run the command, where "VM name" replaced with your own virtual machine name
in dos mode, enter the VirtualBox installation directory, The default is C: \ Program Files \ Oracle \ VirtualBox, execute the following command
# VBoxManage setextradata "VM name" "CustomVideoMode1" "480x800x16"
# VBoxManage setextradata "VM name" "CustomVideoMode2" "320x480x16"
2, modify the grub menu.lst
start the virtual machine, next to the debug mode
remount the partition in RW mode
# mount -o remount,rw /mnt
edit the file:
# vi /mnt/grub/menu.lst
resolution if it is then copied MDPI phone a few lines, then copy HDPI tablet resolution content. They want the title changed to the name of the startup items, such as "Android-x86 480 × 800x16", in the "kernel" and substitute with: < / p>
UVESA_MODE=480x800
320 × 480 resolution is also similar to proceed.
3, in debug mode to restart Android-x86
run the command
# /system/bin/reboot
can
five, configure eclipse allowed to use Virtual Machine Remote Debugging Development
1 , check ip address
enter cosole mode using netcfg or ip command to query the virtual machine ip Address:
which eth0 represents the virtual machine network equipment, back ip address is a virtual machine ip address.
2 , configure eclipse
use Alt + F7 return graphical interface.
Open eclipse , android development plug into the design given interface, select ddms, check Use ado host, and ADT host value a column filled virtual machine ip address, the specific interface Refer to the following chart:
Open devices view, if not loaded devices view, you can use the following method to open devices < / span> view
in devices view, select Restart adb:
or you can use the command line to restart adb , new version adb command in platform-tools directory:
# adb kill-server
# adb start-server
After restarting the virtual machine can be seen already in the list of devices
3 , configuration items run or debug parameters
run or debug the program can select the virtual machine as a debug device
if eclipse not find virtual machine equipment, Please check whether the system is installed pea pods, etc. android linker, if the installation need to stop the related processes.
six, configure SD card
configuration SD cards can use a variety of ways.
1 , the file disguised as a SD card
in console mode, execute the following script: < / span>
# dd if=/dev/zero of=/data/sdcard.img bs=1024 count=65536
# losetup /dev/block/loop7 /data/sdcard.img
# newfs_msdos /dev/block/loop7
which 65536 expressed 64MB of SD card, you can modify this number increases SD card size
restart the virtual machine enters debug mode to RW remount partition
# mount -o remount,rw /mnt
edit the file:
# vi /mnt/grub/menu.lst
add a parameter to the kernel:
SDCARD=/data/sdcard.img
2 , use a separate partition
VirtualBox first need to create a new hard drive, and then attachment to VM:
then debug mode start VM, the new The default partition mounted as / dev / sdb file
create a partition before you can query partitioning:
# fdisk -l /dev/sdb
Use fdisk to create a new partition. After you create a partition, format it:
# fdisk /dev/sdb
subsequent operation of the order contains the following parameters:
- input m to display all the commands listed.
- input p shows hard disk partition situation.
- input a set hard disk boot area.
- Enter n to set the new hard disk partition.
- Enter e hard as [extension] partition (extend).
- input p hard to [main] partition (primary).
- input t change the hard disk partition attributes.
- Type d to delete the hard disk partition attributes.
- enter q to exit without storing the hard disk partition attributes.
- input w end and write disk partition or attribute
input n start creating partitions
< / span>
input p create a primary partition
This step asks partition's serial number, because sdb No partition, so you can choose 1
Enter the starting address of the block, the default can
set end block address, which determines the size of the partition, the specific size and can partition the total number of blocks available here
input w write the partition and exits.
use fat32 bit format the partition:
# newfs_msdos /dev/sdb1
editing the menu.lst file
# vi /mnt/grub/menu.lst
add kernel Parameters: < / p>
SDCARD=sdb1
seven, install applications
1, install the application
If no device is connected, you can physical host command line mode, use the following command to connect
# adb connect 192.168.11.12
can use the following command to install apk:
# adb install -r HelloWorld.apk
but sometimes reported the following error when installed:
more than one device and emulator
can use the following methods:
Find Equipment:
# adb devices
List of devices attached
emulator-5554 device
Installation
# adb -s emulator-5554 install -r HelloWorld.apk
2, uninstall
adb uninstall HelloWorld.apk
or directly delete files
# adb -s emulator-5554 shell
# cd /data/app
# rm HelloWorld.apk
# exit
delete system application:
adb remount (重新挂载系统分区,使系统分区重新可写)。
adb shell
cd system/app
rm *.apk
没有评论:
发表评论