简体   繁体   中英

Does anybody know whether a system app can extend VpnService in Android or not?

Now, I want to develop a system app which will extend VpnService. But when I call the method 'establish()' to initialize an instance of ParcelFileDescriptor. I got an exception in android 5.0 as below:

08-23 20:47:35.482 12344-12365/com.vm.shadowsocks W/System.err: java.lang.SecurityException: Cannot find com.vm.shadowsocks.core.LocalVpnService
            at android.os.Parcel.readException(Parcel.java:1546)
            at android.os.Parcel.readException(Parcel.java:1499)
    08-23 20:47:35.483 12344-12365/com.vm.shadowsocks W/System.err:     at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1779)
            at android.net.VpnService$Builder.establish(VpnService.java:768)
            at com.vm.shadowsocks.core.LocalVpnService.establishVPN(LocalVpnService.java:467)
            at com.vm.shadowsocks.core.LocalVpnService.runVPN(LocalVpnService.java:256)
            at com.vm.shadowsocks.core.LocalVpnService.run(LocalVpnService.java:239)

Thanks!

A normal (user) app can extend VpnService ( documentation ) so I don't know why a system app shouldn't be able to do this.

To interpret you error message is however rather hard frankly, without knowing any of your code. Also, you maybe might want to use an existing (open-source) implementation like eg strongSwan .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM