3

我创建了一个插件,它只是 android 和 ios 的原生 sdk 的包装器。对于 Android,我有一个在插件中导入的 aar 文件。我可以在 IDE 的插件文件中访问 sdk 类,但是当我运行插件的示例应用程序时,应用程序崩溃并出现错误,因为找不到 sdk 文件的类 def。我已经对 apk 进行了分析,它有包含 sdk 的那些文件的类 jar。以下是日志。

[ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/xyz/xyzapp/sdk/xyzSDK;
E/flutter ( 6844):  at com.rajeevjaiswal.xyz.xyzPlugin.onMethodCall(xyzPlugin.java:72)
E/flutter ( 6844):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/flutter ( 6844):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/flutter ( 6844):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/flutter ( 6844):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 6844):  at android.os.MessageQueue.next(MessageQueue.java:325)
E/flutter ( 6844):  at android.os.Looper.loop(Looper.java:142)
E/flutter ( 6844):  at android.app.ActivityThread.main(ActivityThread.java:6494)
E/flutter ( 6844):  at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 6844):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/flutter ( 6844):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/flutter ( 6844): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xyz.xyzapp.sdk.xyzSDK" on path: DexPathList[[zip file "/data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/base.apk"],nativeLibraryDirectories=[/data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86, /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
E/flutter ( 6844):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
E/flutter ( 6844):  at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/flutter ( 6844):  at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/flutter ( 6844):  ... 11 more
E/flutter ( 6844):
F/flutter ( 6844): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
F/libc    ( 6844): Fatal signal 6 (SIGABRT), code -6 in tid 6844 (flutter_example), pid 6844 (flutter_example)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.1.0/OSM1.180201.007/4586646:user/release-keys'
Revision: '0'
ABI: 'x86'
pid: 6844, tid: 6844, name: flutter_example  >>> com.rajeevjaiswal.xyz_example <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
'
eax 00000000  ebx 00001abc  ecx 00001abc  edx 00000006
esi a94aa6c0  edi 00001abc
xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
eip adcccac4  ebp bfa9f308  esp bfa9f298  flags 00200286
backtrace:
#00 pc 00000ac4  [vdso:adccc000] (__kernel_vsyscall+16)
#01 pc 0001edf8  /system/lib/libc.so (syscall+40)
#02 pc 0001f073  /system/lib/libc.so (abort+115)
#03 pc 0115a7f7  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#04 pc 011485fb  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#05 pc 01146390  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#06 pc 011abd29  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#07 pc 01158efd  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#08 pc 0115b549  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#09 pc 0115b48e  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#10 pc 01161b40  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#11 pc 01161b6e  /data/app/com.rajeevjaiswal.xyz_example-6n39Rpe9t5iTFKT4PxjmgA==/lib/x86/libflutter.so (offset 0x113f000)
#12 pc 00014af7  /system/lib/libutils.so (android::SimpleLooperCallback::handleEvent(int, int, void*)+39)
#13 pc 00015936  /system/lib/libutils.so (android::Looper::pollInner(int)+982)
#14 pc 000154d6  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+118)
#15 pc 000e25cb  /system/lib/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long long, int)+59)
#16 pc 007d5428  /system/framework/x86/boot-framework.oat (offset 0x606000) (android.app.NativeActivity.onWindowFocusChangedNative [DEDUPED]+136)
#17 pc 00642262  /system/lib/libart.so (art_quick_invoke_stub+338)
#18 pc 001160cf  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+223)
#19 pc 0032153f  /system/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+335)
#20 pc 0031a7a4  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+836)
#21 pc 0062942c  /system/lib/libart.so (MterpInvokeDirect+428)
#22 pc 006333a1  /system/lib/libart.so (artMterpAsmInstructionStart+14369)
#23 pc 002f3a2b  /system/lib/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+539)
#24 pc 002fa2e7  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+231)
#25 pc 0031a78a  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+810)
#26 pc 00627e14  /system/lib/libart.so (MterpInvokeVirtual+756)
#27 pc 006332a1  /system/lib/libart.so (artMterpAsmInstructionStart+14113)
#28 pc 002f3a2b  /system/lib/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+539)
#29 pc 002fa2e7  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+231)
#30 pc 0031a78a  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+810)
#31 pc 0062964a  /system/lib/libart.so (MterpInvokeStatic+282)
#32 pc 00633421  /system/lib/libart.so (artMterpAsmInstructionStart+14497)
#33 pc 002f3a2b  /system/lib/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+539)
#34 pc 002fa1cb  /system/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*)+139)
#35 pc 006179bf  /system/lib/libart.so (artQuickToInterpreterBridge+1311)
#36 pc 0064832d  /system/lib/libart.so (art_quick_to_interpreter_bridge+77)
#37 pc 00642432  /system/lib/libart.so (art_quick_invoke_static_stub+418)
#38 pc 001160f9  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+265)
#39 pc 00544d6b  /system/lib/libart.so (art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)+91)
#40 pc 00546f65  /system/lib/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+1573)
#41 pc 004adfb3  /system/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobject*)+83)
#42 pc 002677a8  /system/framework/x86/boot.oat (offset 0x1db000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+168)
#43 pc 00642262  /system/lib/libart.so (art_quick_invoke_stub+338)
#44 pc 001160cf  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+223)
#45 pc 0032153f  /system/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+335)
#46 pc 0031a7a4  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+836)
#47 pc 00627e14  /system/lib/libart.so (MterpInvokeVirtual+756)
#48 pc 006332a1  /system/lib/libart.so (artMterpAsmInstructionStart+14113)
#49 pc 002f3a2b  /system/lib/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+539)
#50 pc 002fa1cb  /system/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*)+139)
#51 pc 006179bf  /system/lib/libart.so (artQuickToInterpreterBridge+1311)
#52 pc 0064832d  /system/lib/libart.so (art_quick_to_interpreter_bridge+77)
#53 pc 0160d52d  /system/framework/x86/boot-framework.oat (offset 0x606000) (com.android.internal.os.ZygoteInit.main+2669)
#54 pc 00642432  /system/lib/libart.so (art_quick_invoke_static_stub+418)
#55 pc 001160f9  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+265)
#56 pc 00544d6b  /system/lib/libart.so (art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)+91)
#57 pc 00544b3c  /system/lib/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, char*)+764)
#58 pc 0041b39b  /system/lib/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+907)
#59 pc 001521f6  /system/lib/libart.so (art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, char*, art::Primitive::Type, art::InvokeType)+2950)
#60 pc 0014036b  /system/lib/libart.so (art::CheckJNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+75)
#61 pc 0007497e  /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+62)
#62 pc 000783e8  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+824)
#63 pc 00001db2  /system/bin/app_process32 (main+1602)
4

0 回答 0