我在一个项目中使用.so和aar文件。如果不启用proguard,则该应用程序可以正常运行。但是,当启用proguard时,应用程序崩溃,并且出现以下错误:
A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.NoSuchMethodError' thrown in int com.vendor.vendorsmart.sdk.TabletNative.getImage(long, int, int, int, int, int, int, com.vendor.vendorsmart.sdk.TabletNativeImage, int, java.util.Observer):-2
art/runtime/check_jni.cc:65] in call to CallVoidMethodV
art/runtime/check_jni.cc:65] from int com.vendor.vendorsmart.sdk.TabletNative.getImage(long, int, int, int, int, int, int, com.vendor.vendorsmart.sdk.TabletNativeImage, int, java.util.Observer)
art/runtime/check_jni.cc:65] "AsyncTask #1" prio=5 tid=31 Runnable
art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x131e68c0 self=0xb8792b80
art/runtime/check_jni.cc:65] | sysTid=9089 nice=10 cgrp=apps/bg_non_interactive sched=0/0 handle=0xb884cfa0
art/runtime/check_jni.cc:65] | state=R schedstat=( 9548388843 274772963 949 ) utm=933 stm=22 core=0 HZ=100
art/runtime/check_jni.cc:65] | stack=0xa06e7000-0xa06e9000 stackSize=1036KB
art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held)
art/runtime/check_jni.cc:65] native: #00 pc 00004640 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
art/runtime/check_jni.cc:65] native: #01 pc 00002e8d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
art/runtime/check_jni.cc:65] native: #02 pc 0023f395 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
art/runtime/check_jni.cc:65] native: #03 pc 00224557 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
art/runtime/check_jni.cc:65] native: #04 pc 000af9c3 /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
art/runtime/check_jni.cc:65] native: #05 pc 000b00fd /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
art/runtime/check_jni.cc:65] native: #06 pc 000b320d /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
art/runtime/check_jni.cc:65] native: #07 pc 000ba6c7 /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
09-08 10:57:24.439 9029-9089/com.testApp A/art: art/runtime/check_jni.cc:65] native: #08 pc 00018105 /data/app/com.testApp-1/lib/arm/libNative0.so (_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)+16)
art/runtime/check_jni.cc:65] native: #09 pc 00019dff /data/app/com.testApp-1/lib/arm/libNativeVendorSmartSDK_6.14.5.0.so (Java_com_getImage+414)
art/runtime/check_jni.cc:65] native: #10 pc 003a4b53 /data/dalvik-cache/arm/data@app@com.testApp-1@base.apk@classes.dex (Java_com_vendor_vendorsmart_sdk_TabletNative_getImage__JIIIIIILvendor_vendorsmart_sdk_TabletNativeImage_2ILjava_util_Observer_2+202)
art/runtime/check_jni.cc:65] at com.vendor.vendorsmart.sdk.TabletNative.getImage(Native method)
以下是我对应的库的proguard-rules.pro内容:
-keep class com.vendor.vendorsmart.sdk { *; }
-dontwarn com.vendor.vendorsmart.sdk.TabletNative.**
我是否想添加一些规则来保护自己?