开发者

Titanium Developer, Android Emulator - Passing Custom Arguments

I seem to be plagued by开发者_JAVA百科 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.


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):

    # start the emulator
    emulator_cmd = [
        self.sdk.get_emulator(),
        '-avd',
        avd_name,
        '-port',
        '5560',
        '-sdcard',
        self.sdcard,
        '-logcat',
        '*:d,*',
        '-no-boot-anim',
        '-partition-size',
        '128' # in between nexusone and droid
    ]
    debug(' '.join(emulator_cmd))

    p = subprocess.Popen(emulator_cmd)

Edit this section and add one or more lines for your custom parameter(s).

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜