Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6892941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:35:49+00:00 2026-05-27T06:35:49+00:00

I am experimenting with the VpnService that was added to Android in SDK 4.0.

  • 0

I am experimenting with the VpnService that was added to Android in SDK 4.0. I have gotten as far as starting the VpnService, however, I am unable to create the virtual interface. My code throws an IllegalStateException and I am not able to figure out why. The code is inside a Thread, which is an inner-class of my VPNService-class.

My cut down example looks like this:

        ParcelFileDescriptor pfd = null;

        VpnService.Builder b = new VpnService.Builder();
        try{
            b.addAddress("10.0.6.2", 24);
            b.setMtu(1460);
            b.setSession("TunnelTest");
        } catch(IllegalArgumentException e){
            Log.v("Service", "Address is invalid!");
            stopSelf();
            return;
        }

        try{
            pfd = b.establish();
        } catch (IllegalArgumentException e){
            Log.v("Service", "Interface was provided with an illegal argument");
        } catch (IllegalStateException e){
            e.printStackTrace();
            Log.v("Service", "Illegal state");
        } catch (SecurityException e){
            Log.v("Service", "Security exception thrown");

What I try to do here is to create a virtual interface with IP 10.0.6.2, belonging to the 10.6.0.0/24 subnet. The exception is thrown by the b.establish() call.

This is the full stack trace:

11-30 17:51:10.863: W/System.err(2741): java.lang.IllegalStateException: Cannot create interface
11-30 17:51:10.875: W/System.err(2741):     at android.os.Parcel.readException(Parcel.java:1335)
11-30 17:51:10.875: W/System.err(2741):     at android.os.Parcel.readException(Parcel.java:1281)
11-30 17:51:10.875: W/System.err(2741):     at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1321)
11-30 17:51:10.875: W/System.err(2741):     at android.net.VpnService$Builder.establish(VpnService.java:472)
11-30 17:51:10.875: W/System.err(2741):     at no.simtel.TestVpnService$TestVpn.run(TestVpnService.java:37)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:35:50+00:00Added an answer on May 27, 2026 at 6:35 am

    You can use adb logcat to verify that you are running into this issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just experimenting and learning, and I know how to create a shared dictionary that
Experimenting with android game development. I'm using PNG format for images, and was wondering
When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with
I am experimenting with Dart. I have created an on click event like so:
From experimenting with the r.js optimizer, it seems that there is no way for
While experimenting with iPhone app development, we have several AppIDs which should be deleted
I am experimenting with Interface Builder in Xcode 4.2 and iOS 5 on a
I experimenting with Flex Styling, and I came across an alignment issue. I have
I´m experimenting a bit with css sprites and have a small problem wich I
I'm experimenting with some multithreading constructions, but somehow it seems that multithreading is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.