无法使用新的Android 4.0 VpnService框架
我正在尝试将新的 Android 4.0 VPN 框架与模拟器一起使用。
在我的示例应用程序中,我调用:
Intent intent = VpnService.prepare(SimpleVpnActivity.this);
if(null != intent){
startActivityForResult(intent, 1);
}
但是应用程序因异常而崩溃,因为 VpnService.prepare() 返回一个明确的意图: 意图:{ cmp=com.android.vpndialogs/.ConfirmDialog } 用于无法找到的活动 startActivityForResult()。
我做错了什么吗?
我将不胜感激任何帮助。
这是我的堆栈转储:
E/AndroidRuntime(12783): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.vpndialogs/
com.android.vpndialogs.ConfirmDialog}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime(12783): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
E/AndroidRuntime(12783): at android.app.Instrumentation.execStartActivity(Instrumentation.java: 1384)
E/AndroidRuntime(12783): at android.app.Activity.startActivityForResult(Activity.java:3190)
E/AndroidRuntime(12783): at com.my.simple.vpn.SimpleVpnActivity $1.onClick(SimpleVpnActivity.java:30)
E/AndroidRuntime(12783): at android.view.View.performClick(View.java: 3460)
E/AndroidRuntime(12783): at android.view.View $PerformClick.run(View.java:13955)
E/AndroidRuntime(12783): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime(12783): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(12783): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(12783): at android.app.ActivityThread.main(ActivityThread.java:4340)
E/AndroidRuntime(12783): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12783): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(12783): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(12783): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(12783): at dalvik.system.NativeStart.main(Native Method)
I'm trying to use the new Android 4.0 VPN framework with the Emulator.
In my sample app I'm calling:
Intent intent = VpnService.prepare(SimpleVpnActivity.this);
if(null != intent){
startActivityForResult(intent, 1);
}
But the application crashes with an exception because the
VpnService.prepare() returns an explicit intent:
Intent: { cmp=com.android.vpndialogs/.ConfirmDialog } for activity which can't be found by
startActivityForResult().
Am I doing something wrong?
I would appreciate any help.
Here my stack dump:
E/AndroidRuntime(12783): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.vpndialogs/
com.android.vpndialogs.ConfirmDialog}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime(12783): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
E/AndroidRuntime(12783): at android.app.Instrumentation.execStartActivity(Instrumentation.java: 1384)
E/AndroidRuntime(12783): at android.app.Activity.startActivityForResult(Activity.java:3190)
E/AndroidRuntime(12783): at com.my.simple.vpn.SimpleVpnActivity $1.onClick(SimpleVpnActivity.java:30)
E/AndroidRuntime(12783): at android.view.View.performClick(View.java: 3460)
E/AndroidRuntime(12783): at android.view.View $PerformClick.run(View.java:13955)
E/AndroidRuntime(12783): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime(12783): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(12783): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(12783): at android.app.ActivityThread.main(ActivityThread.java:4340)
E/AndroidRuntime(12783): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12783): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(12783): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(12783): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(12783): at dalvik.system.NativeStart.main(Native Method)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来
com.android.vpndialogs
包没有作为模拟器映像的一部分构建。这是 SDK 团队需要修复的错误。我想说在 b.android.com 上提交错误,但看起来您已经这样做了并且正在接受调查。 :)
参考:http://code.google.com/p/android /问题/详细信息?id=21030
It looks like the
com.android.vpndialogs
package isn't being built as part of the emulator image. That's a bug that the SDK team will need to fix.I'd say to file a bug on b.android.com, but it looks like you've already done that and it's being investigated. :)
Reference: http://code.google.com/p/android/issues/detail?id=21030