Unable to use the new Android 4.0 VpnService platform

I am trying to use the new Android 4.0 VPN infrastructure with an emulator.

In my sample application, I call:

 Intent intent = VpnService.prepare(SimpleVpnActivity.this);
 if(null != intent){
     startActivityForResult(intent, 1);
 }

But the application crashes with an exception, because VpnService.prepare () returns an explicit intention: Target: {cmp = com.android.vpndialogs / .ConfirmDialog} for an activity that cannot be found startActivityForResult ().

Am I doing something wrong?

I would be grateful for any help.

Here is my stack:

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)
+5
source share
1 answer

It seems that the package is com.android.vpndialogsnot created as part of the emulator image. This is a bug that the SDK team will need to fix.

, bug b.android.com, , .:)

: http://code.google.com/p/android/issues/detail?id=21030

+4

All Articles