Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not use new Android 4.0 VpnService framework

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)
like image 344
Andrew Avatar asked Oct 10 '22 17:10

Andrew


1 Answers

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

like image 179
Trevor Johns Avatar answered Oct 13 '22 10:10

Trevor Johns