Android SQLCipher无法在发布模式下工作

时间:2014-11-18 16:17:15

标签: android sqlcipher

我有一个使用SQLCipher的Android应用,我使用过SQLCipher主网站

question

我已准备好所有正确的罐子和.so文件。

在proguard文件中,我指定保留SQLCipher文件。

当我在发布模式下导出应用程序并将其托管在我的私人服务器上时,我在安装时会得到以下stackTrace。

如果我不使用proguard,它将在发布模式下工作,所以这绝对是一个问题。

有谁知道为什么它在调试模式下工作但没有一次导出?

11-18 16:09:18.911: E/MP-Decision(1683): Update arg 2
11-18 16:09:18.991: E/MP-Decision(1683): Update arg 2
11-18 16:09:19.001: E/MP-Decision(1683): Update arg 2
11-18 16:09:19.001: E/MP-Decision(1683): Update arg 4
11-18 16:09:19.001: E/MP-Decision(1683): Update arg "0 190 240 240".
11-18 16:09:19.001: E/MP-Decision(1683): Update arg "0 75 400 400".
11-18 16:09:19.281: E/RR3ContentProvider(25278): inside RR3ContentProvider onCreate
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011] No pending exception expected: java.lang.NoSuchFieldError: no "I" field "nHandle" in class "Lnet/sqlcipher/database/SQLiteCompiledSql;" or its superclasses
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:421)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:362)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:533)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File) ((null):-1)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context) ((null):-1)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void com.carefreegroup.rr3.LoginValidate.<init>(android.content.Context) ((null):-1)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void com.carefreegroup.rr3.NfcScannerApplication.onCreate() ((null):-1)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1020)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:4924)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.app.ActivityThread.access$1500(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:153)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1412)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.os.Looper.loop() (Looper.java:157)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5633)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:896)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:712)
11-18 16:09:19.441: A/art(25278): art/runtime/thread.cc:1011] 
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203] Runtime aborting...
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203] Aborting thread:
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203] "main" prio=5 tid=1 Runnable
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   | group="main" sCount=0 dsCount=0 obj=0x6747afc8 self=0x41ec7f10
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   | sysTid=25278 nice=0 cgrp=apps sched=0/0 handle=0x40049198
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   | state=R schedstat=( 0 0 0 ) utm=4 stm=2 core=1 HZ=100
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   | stack=0xbe57b000-0xbe57f000 stackSize=8MB
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::DumpStack(std::ostream&) const+87 [0x41708914] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x41700b8c] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::Runtime::Abort()+79 [0x4170111c] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::LogMessage::~LogMessage()+505 [0x415ad9aa] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x4170b040] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::ThrowNewExceptionV(art::ThrowLocation const&, char const*, char const*, std::__va_list)+109 [0x4170b50a] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::ThrowNewExceptionF(art::ThrowLocation const&, char const*, char const*, ...)+15 [0x4170b52c] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416c2096] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416c2c4e] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: sqlcipher::register_android_database_SQLiteCompiledSql(_JNIEnv*)+75 [0x4b540280] (libdatabase_sqlcipher.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: JNI_OnLoad+71 [0x4b5405b4] (libdatabase_sqlcipher.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: art::JavaVMExt::LoadNativeLibrary(std::string const&, art::mirror::ClassLoader*, std::string&)+1155 [0x416c4bdc] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416e1332] (libart.so)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.nativeLoad(Native method)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.doLoad(Runtime.java:421)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   - locked <0x674774a8> (a java.lang.Runtime)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.loadLibrary(Runtime.java:362)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.System.loadLibrary(System.java:533)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at net.sqlcipher.database.SQLiteDatabase.loadLibs(unavailable:-1)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at net.sqlcipher.database.SQLiteDatabase.loadLibs(unavailable:-1)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at com.carefreegroup.rr3.LoginValidate.<init>(unavailable:-1)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at com.carefreegroup.rr3.NfcScannerApplication.onCreate(unavailable:-1)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4924)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.access$1500(ActivityThread.java:153)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.os.Handler.dispatchMessage(Handler.java:102)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.os.Looper.loop(Looper.java:157)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.main(ActivityThread.java:5633)
11-18 16:09:19.591: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.reflect.Method.invoke(Native method)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] Pending exception java.lang.NoSuchFieldError thrown by 'java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String):-2'
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] java.lang.NoSuchFieldError: no "I" field "nHandle" in class "Lnet/sqlcipher/database/SQLiteCompiledSql;" or its superclasses
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:421)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:362)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:533)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File) ((null):-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context) ((null):-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void com.carefreegroup.rr3.LoginValidate.<init>(android.content.Context) ((null):-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void com.carefreegroup.rr3.NfcScannerApplication.onCreate() ((null):-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1020)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:4924)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.app.ActivityThread.access$1500(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:153)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1412)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.os.Looper.loop() (Looper.java:157)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5633)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:896)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:712)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] Dumping all threads without appropriate locks held: thread list lock
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] All threads:
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] DALVIK THREADS (12):
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] "main" prio=5 tid=1 Runnable
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   | group="main" sCount=0 dsCount=0 obj=0x6747afc8 self=0x41ec7f10
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   | sysTid=25278 nice=0 cgrp=apps sched=0/0 handle=0x40049198
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   | state=R schedstat=( 0 0 0 ) utm=7 stm=2 core=2 HZ=100
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   | stack=0xbe57b000-0xbe57f000 stackSize=8MB
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::DumpStack(std::ostream&) const+87 [0x41708914] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::ThreadList::DumpLocked(std::ostream&)+67 [0x41713884] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x41700c3e] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::Runtime::Abort()+79 [0x4170111c] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::LogMessage::~LogMessage()+505 [0x415ad9aa] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x4170b040] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::ThrowNewExceptionV(art::ThrowLocation const&, char const*, char const*, std::__va_list)+109 [0x4170b50a] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::Thread::ThrowNewExceptionF(art::ThrowLocation const&, char const*, char const*, ...)+15 [0x4170b52c] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416c2096] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416c2c4e] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: sqlcipher::register_android_database_SQLiteCompiledSql(_JNIEnv*)+75 [0x4b540280] (libdatabase_sqlcipher.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: JNI_OnLoad+71 [0x4b5405b4] (libdatabase_sqlcipher.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: art::JavaVMExt::LoadNativeLibrary(std::string const&, art::mirror::ClassLoader*, std::string&)+1155 [0x416c4bdc] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   native: ??? [0x416e1332] (libart.so)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.nativeLoad(Native method)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.doLoad(Runtime.java:421)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   - locked <0x674774a8> (a java.lang.Runtime)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.Runtime.loadLibrary(Runtime.java:362)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.System.loadLibrary(System.java:533)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at net.sqlcipher.database.SQLiteDatabase.loadLibs(unavailable:-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at net.sqlcipher.database.SQLiteDatabase.loadLibs(unavailable:-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.carefreegroup.rr3.LoginValidate.<init>(unavailable:-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.carefreegroup.rr3.NfcScannerApplication.onCreate(unavailable:-1)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4924)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.access$1500(ActivityThread.java:153)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.os.Handler.dispatchMessage(Handler.java:102)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.os.Looper.loop(Looper.java:157)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at android.app.ActivityThread.main(ActivityThread.java:5633)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at java.lang.reflect.Method.invoke(Native method)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] 
11-18 16:09:19.601: A/art(25278): art/runtime/runtime.cc:203] "Thread pool worker 0" prio=5 tid=2 Native (still st

...

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


-keep public class net.sqlcipher.** {
    *;
}

-keep public class net.sqlcipher.database.** {
    *;
}

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}
-dontwarn com.google.android.gms.**
-dontwarn com.google.common.**

1 个答案:

答案 0 :(得分:1)

我建议使用随SQLCipher for Android一起发布的示例ProGuard文件。可以找到样本here