6

I am working on VPN app and follows the code of strongswan app. I have used the code of this app and it is loading .so files through JNI and i have copied these files from the strongswan project. It gives this exception for one of these files:

A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/java_vm_ext.cc:410]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/java_vm_ext.cc:410]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410] 
art/runtime/java_vm_ext.cc:410]     in call to NewGlobalRef
art/runtime/java_vm_ext.cc:410]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
art/runtime/java_vm_ext.cc:410] "main" prio=5 tid=1 Runnable
art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/java_vm_ext.cc:410]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 0 0 0 ) utm=15 stm=9 core=6 HZ=100
art/runtime/java_vm_ext.cc:410]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
art/runtime/java_vm_ext.cc:410]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/java_vm_ext.cc:410]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025b30b  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+742)
art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/java_vm_ext.cc:410]   native: #05 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/java_vm_ext.cc:410]   native: #06 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/java_vm_ext.cc:410]   native: #07 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/java_vm_ext.cc:410]   native: #08 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/java_vm_ext.cc:410]   native: #09 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/java_vm_ext.cc:410]   native: #10 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/java_vm_ext.cc:410]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class.newInstance!(Native method)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at android.os.Looper.loop(Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410] 
A/art: art/runtime/runtime.cc:366] Runtime aborting...
art/runtime/runtime.cc:366] Aborting thread:
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Native
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=10 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 00333fb9  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+28)
art/runtime/runtime.cc:366]   native: #03 pc 00334257  /system/lib/libart.so (art::Runtime::Abort()+566)
art/runtime/runtime.cc:366]   native: #04 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #05 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #06 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #07 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #08 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #09 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #10 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #11 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #12 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #13 pc 0020d51d  /system/framework/arm/boot.oat (???)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/runtime.cc:366]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/runtime.cc:366]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/runtime.cc:366]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/runtime.cc:366]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/runtime.cc:366]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
art/runtime/runtime.cc:366] All threads:
art/runtime/runtime.cc:366] DALVIK THREADS (12):
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Runnable
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=12 core=0 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 0035b0b7  /system/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+446)
art/runtime/runtime.cc:366]   native: #03 pc 0035bc79  /system/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*)+212)
art/runtime/runtime.cc:366]   native: #04 pc 0035c1ef  /system/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+154)
art/runtime/runtime.cc:366]   native: #05 pc 003341cd  /system/lib/libart.so (art::Runtime::Abort()+428)
art/runtime/runtime.cc:366]   native: #06 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #07 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #08 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #09 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #10 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #11 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #12 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #13 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #14 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #15 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366] 
art/runtime/runtime.cc:366] "Signal Catcher" prio=5 tid=2 WaitingInMainSignalCatcherLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c680a0 self=0xee3e2c00
art/runtime/runtime.cc:366]   | sysTid=15407 nice=0 cgrp=default sched=0/0 handle=0xf425c930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4160000-0xf4162000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: do_sigtimedwait+0xd8/0x1ac
art/runtime/runtime.cc:366]   kernel: compat_SyS_rt_sigtimedwait+0x94/0xd8
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 0004135c  /system/lib/libc.so (__rt_sigtimedwait+12)
art/runtime/runtime.cc:366]   native: #01 pc 0001d0df  /system/lib/libc.so (sigwait+22)
art/runtime/runtime.cc:366]   native: #02 pc 0033aae9  /system/lib/libart.so (art::SignalCatcher::WaitForSignal(art::Thread*, art::SignalSet&)+76)
art/runtime/runtime.cc:366]   native: #03 pc 0033c535  /system/lib/libart.so (art::SignalCatcher::Run(void*)+260)
art/runtime/runtime.cc:366]   native: #04 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #05 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366] 
art/runtime/runtime.cc:366] "JDWP" prio=5 tid=3 WaitingInMainDebuggerLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c6b0a0 self=0xee43b900
art/runtime/runtime.cc:366]   | sysTid=15408 nice=0 cgrp=default sched=0/0 handle=0xf415d930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4061000-0xf4063000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: poll_schedule_timeout+0x54/0xb8
art/runtime/runtime.cc:366]   kernel: do_select+0x414/0x468
art/runtime/runtime.cc:366]   kernel: compat_core_sys_select+0x160/0x20c
art/runtime/runtime.cc:366]   kernel: compat_sys_pselect6+0x178/0x214
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00041278  /system/lib/libc.so (__pselect6+20)
art/runtime/runtime.cc:366]   native: #01 pc 0001c431  /system/lib/libc.so (select+60)
art/runtime/runtime.cc:366]   native: #02 pc 00402093  /system/lib/libart.so (art::JDWP::JdwpAdbState::ProcessIncoming()+218)
art/runtime/runtime.cc:366]   native: #03 pc 00267a2f  /system/lib/libart.so (art::JDWP::JdwpState::Run()+314)
art/runtime/runtime.cc:366]   native: #04 pc 002688ad  /system/lib/libart.so (art::JDWP::StartJdwpThread(void*)+16)
art/runtime/runtime.cc:366]   native: #05 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #06 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=5 tid=4 Waiting
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c64e80 self=0xee43a500
art/runtime/runtime.cc:366]   | sysTid=15409 nice=0 cgrp=default sched=0/0 handle=0xf405e930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf3f5c000-0xf3f5e000 stackSize=1038KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
art/runtime/runtime.cc:366]   kernel: futex_wait+0xd8/0x1cc
art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
art/runtime/runtime.cc:366]   kernel: compat_SyS_futex+0xd0/0x14c
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00017684  /system/lib/libc.so (syscall+28)
art/runtime/runtime.cc:366]   native: #01 pc 000f6d05  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+96)
art/runtime/runtime.cc:366]   native: #02 pc 002bf87d  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+1144)
art/runtime/runtime.cc:366]   native: #03 pc 002c05db  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, art::mirror::Object*, long long, int, bool, art::ThreadState)+142)
art/runtime/runtime.cc:366]   native: #04 pc 002d1e2b  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+38)

Excecption pointing error at this line :

System.loadLibrary("androidbridge");

Package name in the exception is the package name of the project from where i copied the code. org.strongswan.android.logic.CharonVpnService

but my app's package name is com.whizpool.vpn.logic.CharonVpnService.

I have searched this org.strongswan.android every where but no where in my project.

here is my manifest file:

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.whizpool.vpn">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.whizpool.vpn.action.START_PROFILE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service
            android:name=".logic.VpnStateService"
            android:exported="false" >
        </service>
        <service
            android:name=".logic.CharonVpnService"
            android:exported="false"
            android:permission="android.permission.BIND_VPN_SERVICE" >
            <intent-filter>
                <action android:name="android.net.VpnService" />
            </intent-filter>
        </service>

        <provider
            android:name=".data.LogContentProvider"
            android:authorities="com.whizpool.vpn.content.log"
            android:exported="true" >
            <!-- android:grantUriPermissions="true" combined with a custom permission does
                 not work (probably too many indirections with ACTION_SEND) so we secure
                 this provider with a custom ticketing system -->
        </provider>
    </application>

</manifest>[enter link description here][1]
shizhen
  • 12,251
  • 9
  • 52
  • 88
zaheer ahmed
  • 168
  • 1
  • 2
  • 11
  • have you used any third-party library with package name `org.strongswan.android.logic.CharonVpnService` in our project ? [Package name link](https://github.com/strongswan/strongswan/blob/master/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java) – Chethan Kumar Dec 13 '18 at 05:48
  • not using library just using some classes from this – zaheer ahmed Dec 13 '18 at 06:00
  • have u checked the package of name of that particular class you have used from the above link. what im thinking is, we should have to declare service class inside manifest . I have faced slimier exception when Activity name is not declare in manifest. please do check in manifest – Chethan Kumar Dec 13 '18 at 06:03
  • updated my post please have a look on manifest – zaheer ahmed Dec 13 '18 at 06:07
  • Do you have the compiled form of strongswan project? – Jordan Jan 10 '19 at 11:31
  • @Jordan yes i have – zaheer ahmed Sep 12 '19 at 11:09
  • I have compiled it myself. Thanks. @zaheerahmed – Jordan Sep 12 '19 at 11:13

3 Answers3

2

Do not Change package name in StrongsWan package classes. Import the Strongswan project as a module in your application.

Compile the Strongswan module as a library, then you can use features of the Strongswan project.

Do not change package name in JNI files, because Jni methods are prefixed with strongswan package name.

Mike Yang
  • 2,581
  • 3
  • 24
  • 27
Muhammad Hassaan
  • 874
  • 6
  • 18
1

Be careful with the package name of the native file (XXX.so file)
if the so file is not in the correct package/directory, you may get this error.

Mike Yang
  • 2,581
  • 3
  • 24
  • 27
0

Package name in the exception is the package name of the project from where i copied the code. "org.strongswan.android.logic.CharonVpnService"

but my app's package name is "com.whizpool.vpn.logic.CharonVpnService".

No, you cannot do this. You have to specify the package name and class name exactly the same as the one referenced inside JNI code. The shared libraries, i.e. the .so files, have to match well with the correct Jar library because of the package name and class name are the unique references from C side to refer back to Java side.

Community
  • 1
  • 1
shizhen
  • 12,251
  • 9
  • 52
  • 88