如何在Android Emulator中启用VPN支持

时间:2011-01-04 03:12:18

标签: android android-emulator android-2.2-froyo

我喜欢在Android模拟器中使用PPTP VPN。我的VPN提供商是Witopia。这些设置适用于真实手机(HTC Desire)。

它不起作用,连接只是在一段时间后超时。

adb logcat 打印:

D/VpnManager( 1527): succeeded to connect to VPN service
D/com.android.settings.vpn.AuthenticationActor( 1527): ~~~~~~ connect() succeeded!
I/SProxy_mtpd( 2211): Stop VPN daemon: mtpd
D/VpnSettings( 1527): received connectivity: Witopia: connected? CONNECTING   err=0
D/SProxy_mtpd( 2211): mtpd is stopped after 0 msec
D/SProxy_mtpd( 2211): stopping mtpd, success? true
I/SProxy_racoon( 2211): Stop VPN daemon: racoon
D/SProxy_racoon( 2211): racoon is stopped after 0 msec
D/SProxy_racoon( 2211): stopping racoon, success? true
D/VpnService( 2211):   Local IP: 10.0.2.15, if: eth0
D/VpnService( 2211):        VPN UP: down
I/SProxy_mtpd( 2211): Start VPN daemon: mtpd
D/SProxy_mtpd( 2211): mtpd is running after 0 msec
D/SProxy_mtpd( 2211): service not yet listen()ing; try again
D/mtpd    ( 2224): Waiting for control socket
D/mtpd    ( 2224): Received 19 arguments
I/mtpd    ( 2224): Using protocol pptp
I/mtpd    ( 2224): Connecting to 203.131.247.213 port 1723
I/SProxy_mtpd( 2211): got data from control socket: 19
I/mtpd    ( 2224): Connection established (socket = 10)
D/mtpd    ( 2224): Sending SCCRQ
D/mtpd    ( 2224): Received SCCRP -> Sending OCRQ (local = 32087)
I/mtpd    ( 2224): Tunnel established
D/mtpd    ( 2224): Received OCRQ (remote = 52286)
I/mtpd    ( 2224): Session established
I/mtpd    ( 2224): Creating PPPoX socket
F/mtpd    ( 2224): Socket() Address family not supported by protocol

后跟用户消息:无法连接到网络。你想再试一次吗?

同时在 adb logcat

E/VpnService( 2211): onError()
E/VpnService( 2211): java.io.IOException: Connecting timed out
E/VpnService( 2211):    at com.android.server.vpn.VpnService.waitUntilConnectedOrTimedout(VpnService.java:206)
E/VpnService( 2211):    at com.android.server.vpn.VpnService.onConnect(VpnService.java:136)
E/VpnService( 2211):    at com.android.server.vpn.VpnServiceBinder$2.run(VpnServiceBinder.java:114)
E/VpnService( 2211):    at java.lang.Thread.run(Thread.java:1096)
I/VpnService( 2211): disconnecting VPN...
D/VpnSettings( 1527): received connectivity: Witopia: connected? DISCONNECTING   err=0
I/SProxy_mtpd( 2211): Stop VPN daemon: mtpd
D/SProxy_mtpd( 2211): mtpd is stopped after 0 msec
D/SProxy_mtpd( 2211): stopping mtpd, success? true
I/SProxy_racoon( 2211): Stop VPN daemon: racoon
D/SProxy_racoon( 2211): racoon is stopped after 0 msec
D/SProxy_racoon( 2211): stopping racoon, success? true
D/VpnService( 2211): onFinalCleanUp()
I/VpnService( 2211): restore original suffices --> null
D/VpnSettings( 1527): received connectivity: Witopia: connected? IDLE   err=101

我猜这可能是权限问题,也可能是Android模拟器不支持。

我的平台是MacOSX,Emulator正在运行Android 2.2。

这个问题与:

有关

3 个答案:

答案 0 :(得分:4)

是的,这就像内核问题:

  1. 没有tun.ko模块(请参阅http://forum.xda-developers.com/showthread.php?t=630703&page=2
  2. 不支持lkm(可加载内核模块)(http://code.google.com/p/get-a-robot-vpnc/issues/detail?id=100)
  3. 所以我认为你需要自定义内核 http://code.google.com/p/batterymine/wiki/BuildingInModuleSupport

    此外,您还需要复制到模拟器其他模块:slhc.ko,ppp * .ko

答案 1 :(得分:3)

我遇到了与2.2模拟器相同的问题。我切换到4.2模拟器,它通过VPN正常工作。

答案 2 :(得分:0)

从设备管理器擦除模拟器数据,然后重新启动模拟器。我希望这会有所帮助。

wipe data