JNI在应用程序中检测到错误:调用JNI NewGlobalRef并带有未决异常java.lang.ClassNotFoundException:

时间:2018-12-13 05:31:25

标签: android protocols vpn strongswan

我正在使用VPN应用,并遵循strongswan应用的代码。我已经使用了该应用程序的代码,它正在通过JNI加载.so文件,并且我已经从Strongswan项目中复制了这些文件。对于以下文件之一,它给出了例外:

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)

此行的异常指向错误:

System.loadLibrary("androidbridge");

包名称中的例外是我从中复制代码的项目的包名称。 org.strongswan.android.logic.CharonVpnService

但我的应用的程序包名称为com.whizpool.vpn.logic.CharonVpnService

我在项目中的所有位置搜索了org.strongswan.android,但没有搜索任何地方。

这是我的清单文件:

 <?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]

3 个答案:

答案 0 :(得分:0)

  

包名称中的例外是我从中复制代码的项目的包名称。 “ org.strongswan.android.logic.CharonVpnService”

     

但是我的应用程序的程序包名称是“ com.whizpool.vpn.logic.CharonVpnService”。

不,您不能这样做。您必须指定包名称和类名称与在JNI代码中引用的包名称和类名称完全相同。共享库(即.so文件)必须与正确的 Jar 库匹配,因为程序包名称和类名称唯一的 C端引用以返回到 Java端

答案 1 :(得分:0)

请勿在StrongsWan软件包类中更改软件包名称。将Strongswan项目作为模块导入您的应用程序。然后将Strongswan模块编译为库。然后您可以使用Strongswan项目的功能。不要更改jni文件中的程序包名称,因为Jni方法的前缀是Strongswan程序包名称。

答案 2 :(得分:0)

请注意本机文件(XXX.so文件)的程序包名称
如果so文件不在正确的包/目录中,则可能会出现此错误。