Titanium 开发人员、Android 模拟器 - 传递自定义参数
我似乎被很多人遇到的一个问题所困扰,当我运行我的 Android 模拟器时,它无法有任何可用的互联网连接。如果我手动运行模拟器并传递“-dns-server 8.8.8.8”,它就可以正常工作。
emulator.exe -dns-server 8.8.8.8 -avd {NAME}
我想做的是在通过 Titanium Studio 启动模拟器时添加“-dns-server 8.8.8.8”作为自定义参数。我已经弄清楚如何在 Android SDK 的 Eclipse 中执行此操作,但没有通过 Titanium Studio 执行此操作,因为相同的选项不可用。
Titanium 似乎使用以下参数启动模拟器:
\tools\emulator.exe -avd titanium_15_HVGA -port 5560 -sdcard C:\Users\dhiggins\.titanium\titanium_15_HVGA.sdcard -logcat *:d,* -no-boot-anim -partition-size 128
顺便说一句,如果我将 NIC 设置为“自动获取”而不是使用静态地址,则 Android 模拟器可以在互联网上正常工作。然而,我的开发机器上需要一个静态地址。
I seem to be plagued by an issue that a lot of people run into, when I run my Android Emulator it fails to have any usable internet connection. If I run the emulator manually and pass "-dns-server 8.8.8.8" it works just fine.
emulator.exe -dns-server 8.8.8.8 -avd {NAME}
What I'd like to do is add this "-dns-server 8.8.8.8" as a custom argument when launching the emulator through Titanium Studio. I've figured out how to do this in Eclipse for the Android SDK, but not through Titanium Studio as the same options are not available.
Titanium appears to launch the emulator with the following arguments:
\tools\emulator.exe -avd titanium_15_HVGA -port 5560 -sdcard C:\Users\dhiggins\.titanium\titanium_15_HVGA.sdcard -logcat *:d,* -no-boot-anim -partition-size 128
On a side note, it appears that if I setup my NIC to "Obtain Automatically" rather than use a static address, the Android Emulator works just fine with the internet. I, however, require a static address on my development machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先要诊断静态分配问题的根源。您的静态 IP 是否列出了适当的 DNS 服务器?自动获取时,DHCP 提供了几个参数,包括 DNS 服务器列表。
无论如何,更新启动 android 模拟器的命令是相当简单的,至少对于 Windows 平台来说是这样。我不得不认为苹果的移动 SDK 中也有类似的东西。
找到移动 SDK 文件夹。在 Win 7 下,它是 C:\ProgramData\Titanium\mobilesdk。在 mobile SDK 文件夹下,打开 \android\builder.py 并找到以下内容(搜索 -avd 即可找到它):
编辑此部分并为您的自定义参数添加一行或多行。
祝你好运!
I would first start with diagnosing the source of the problem on the static allocation. Does your static IP have the appropriate DNS server listed? When obtain automatically, there are several parameters DHCP provides, including the DNS server list.
In any case, it is fairly simple to update the commands to start the android emulator, at least for the Windows platform. I have to think that there is something similar in the mobile SDK for Apple.
Locate the mobile SDK folder. Under Win 7 it is C:\ProgramData\Titanium\mobilesdk. Under the mobile SDK folder open \android\builder.py and locate the following (search for -avd gets you right to it):
Edit this section and add one or more lines for your custom parameter(s).
Good luck!