在 Windows 10 64、Oracle VM VirtualBox 5.2.2 下安装运行 Genymotion 2.11.0,以测试本地H5页面

1、打开网址:https://www.genymotion.com/download/ ,由于已经安装了 Oracle VM VirtualBox,所以选择 without VirtualBox,如图1

图1

2、安装完毕后,新建一个虚拟设备,Android version 选择 7.0.0,最终选择 Samsung Galaxy S8 – 7.0.0,下一步,如图2

图2

3、新建完毕,点击 Start 按钮,启动设备,如图3

图3

4、打开浏览器,输入百度网址,测试,正常,如图4

图4

5、打开 Windows PowerShell,执行命令:ipconfig,查看最后一个 VirtualBox Host-Only Network #3,如图5

图5

6、打开网址:192.168.118.2/phpinfo.php,报错:URISyntaxException: Illegal character in path at index 0: 192.168.118.2/phpinfo.php,如图6

图6

7、打开 Oracle VM VirtualBox,设置 Samsung Galaxy S8 – 7.0.0 的网络,网卡1,混杂模式:全部允许,如图7

图7

8、再次打开网址:192.168.118.2/phpinfo.php,正常,如图8

图8

9、使用域名(default.interact.shenzhen.localhost)连接到本地 摇一摇 网站,编辑hosts,类似于本地的hosts,如图9

图9

10、以管理员身份运行,打开 Windows PowerShell,进入工具目录,依次执行如下命令,如图10
cd ‘C:\Program Files\Genymobile\Genymotion\tools’
.\adb devices
.\adb root
.\adb remount
.\adb pull /system/etc/hosts hosts
ls

图10

11、执行命令:ipconfig,复制 以太网适配器 以太网: IPv4 地址,如图11

图11

12、编辑:C:\Program Files\Genymobile\Genymotion\tools\hosts,如图12
172.28.28.18 default.interact.shenzhen.localhost

图12

13、执行如下命令,如图13
.\adb push hosts /system/etc/hosts

图13

14、打开网址:default.interact.shenzhen.localhost,报错:Webpage not available,如图14

图14

15、调整第12步骤,放弃使用 Windows 编辑器 EditPlus,使用 Linux 编辑,通过 FTP 上传与下载,如图15

图15

16、执行如下命令:,正常,如图16
.\adb push hosts /system/etc/hosts
.\adb shell cat -e /system/etc/hosts
.\adb shell ping default.interact.shenzhen.localhost

图16

17、打开网址:default.interact.shenzhen.localhost,报错:Webpage not available,如图14

图14

18、打开网址:http://www.ghisler.com/android.htm#download ,下载 Total Commander,如图18

图18

19、拖拽 tcandroid280.apk 至 虚拟设备中,点击 Allow 按钮,如图19

图19

20、依次点击 File system root、etc、hosts、Edit file ,如图20、21、22、23

图20

图21

图22

图23

21、虽然发现hosts文件中已经存在修改记录,建议重新编辑一次,如图24、25、26、27、28

图24

图25

图26

图27

22、编辑失败,如图29

图29

23、新建一个虚拟设备,Samsung Galaxy S7 – 6.0.0,基于 Total Commander 编辑 hosts 成功,如图30

图30

24、打开网址:default.interact.shenzhen.localhost,报错:Webpage not available,如图14

图14

25、新建一个虚拟设备,Samsung Galaxy S6 – 5.1.0,基于 Total Commander 编辑 hosts 成功,且打开网址:default.interact.shenzhen.localhost,正常,如图31

图31

26、由于需要复制网址至虚拟设备中,在VirtualBox中,Samsung Galaxy S6 – 5.1.0,常规 – 高级 – 共享粘贴板与拖放 – 双向,如图32

图32

27、关闭虚拟设备,拖拽 kf.txt 至虚拟设备中,提示成功,但是在虚拟设备中不存在,如图33

图33

28、以管理员身份运行,打开 Windows PowerShell,进入工具目录,依次执行如下命令:
cd ‘C:\Program Files\Genymobile\Genymotion\tools’
.\adb devices
.\adb root
.\adb remount
.\adb push kf.txt /sdcard/storage/kf.txt

29、在虚拟设备中,/sdcard/storage/kf.txt已经存在,如图34

图34

30、打开 /sdcard/storage/kf.txt,复制某页面的链接,在浏览器中打开,如图35

图35

31、此页面是摇一摇的页面,发现还是无法测试了,没有找到有效方法模拟的。

 

 

永夜