SQLCipher导致Android Signed Release中的崩溃APK
作者:互联网
我在一个Android项目中使用SQLCipher.一切在测试中都可以正常运行,但是每当我构建并签名的APK并安装它时,我都会收到以下错误并在每次致电时崩溃
SQLCipher.loadLibs(context);
这是崩溃
03-09 14:47:45.833 24895-24895/? E/Database: Can't find SQLiteDatabase.mNativeHandle
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] No pending exception expected: java.lang.NoSuchFieldError: no "I" field "mNativeHandle" in class "Lnet/sqlcipher/database/SQLiteDatabase;" or its superclasses
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:428)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:369)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void java.lang.System.loadLibrary(java.lang.String) (System.java:988)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void net.sqlcipher.database.SQLiteDatabase.a(android.content.Context, java.io.File) ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void net.sqlcipher.database.SQLiteDatabase.a(android.content.Context) ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void com.myapp.BBISDK.ax.o() ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void com.myapp.BBISDK.ax.<init>(java.lang.Integer, com.myapp.BBISDK.d.a, android.app.Activity) ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at com.myapp.BBISDK.ax com.myapp.BBISDK.ax.a(java.lang.Integer, com.myapp.BBISDK.d.a, android.app.Activity) ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void com.myapp.myapp.LoginActivity.onCreate(android.os.Bundle) ((null):-1)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:5990)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1106)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2278)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2387)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.ActivityThread.access$800(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:151)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1303)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.os.Looper.loop() (Looper.java:135)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5254)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[], boolean) (Method.java:-2)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:372)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:903)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:698)
03-09 14:47:45.834 24895-24895/? A/art: art/runtime/thread.cc:1143]
03-09 14:47:45.965 24895-24895/? A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x203a79ac in tid 24895 (kit.myapp)
03-09 14:47:45.965 24895-24895/? I/libc: Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0
在调试中实时运行应用程序时,我收到类似的错误,但不会导致崩溃.
这里任何方向都很好.谢谢.
解决方法:
当您从调试转移到发行版本时,开始出现NoSuchFieldError或类似的“嘿,这东西不见了!”错误,请先转到ProGuard设置.如果类或程序包的-keep解决了问题,则至少有权宜之计.不过,您可以添加一个TODO项目以提出更细粒度的解决方案.
标签:sqlcipher,android,sqlcipher-android 来源: https://codeday.me/bug/20191118/2032176.html