ProGuard Android obfuscation

2,224 views
Skip to first unread message

Emery Galambos

unread,
Jun 29, 2012, 11:06:59 PM6/29/12
to sqlc...@googlegroups.com
I have the following in my proguard.cfg file and I absolutely cannot run my obfuscated APK file to save my life

-keep class info.guardianproject.database.** {*;}
-keep class info.guardianproject.database.sqlcipher.** {*;}

-libraryjars /libs/commons-codec.jar
-libraryjars /libs/guava-r09.jar
-libraryjars /libs/sqlcipher.jar
-libraryjars /assets/icudt46l.zip

What is the "secret" to being able to configure a proguard.cfg file for SQLCipher use??

Thanks,
Emery

Karan Popali

unread,
Jun 29, 2012, 11:30:35 PM6/29/12
to sqlc...@googlegroups.com
Try adding "-dontskipnonpubliclibraryclasses" to proguard.cfg.


Thanks,
-Karan.

Emery Galambos

unread,
Jun 30, 2012, 12:21:07 AM6/30/12
to sqlc...@googlegroups.com
I already had that in proguard.cfg and it still isn't working....  

Here is my entire proguard.cfg:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-ignorewarnings 
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep class info.guardianproject.database.** {*;}
-keep class info.guardianproject.database.sqlcipher.** {*;}

-libraryjars /libs/commons-codec.jar
-libraryjars /libs/guava-r09.jar
-libraryjars /libs/sqlcipher.jar
-libraryjars /assets/icudt46l.zip
     
-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
}

Billy Gray

unread,
Jul 2, 2012, 8:48:20 AM7/2/12
to sqlc...@googlegroups.com
Hi Emery,

I don't know anything about ProGuard configs, but the namespace was changed from info.guardianproject.database to net.sqlcipher.database, perhaps that will help?

Regards,
Billy Gray
--
Team Zetetic
http://zetetic.net

Emery Galambos

unread,
Jul 2, 2012, 12:13:59 PM7/2/12
to sqlc...@googlegroups.com
Hi Billy,

I've tried changing the references accordingly.  No matter what I do, at run-time I get:

07-02 06:51:47.497: W/dalvikvm(6633): VFY: 'this' arg 'Ljava/lang/Object;' not instance of 'Lnet/sqlcipher/database/SQLiteProgram;'
07-02 06:51:47.497: W/dalvikvm(6633): VFY:  rejecting opcode 0x6e at 0x013d
07-02 06:51:47.501: W/dalvikvm(6633): VFY:  rejected Lnet/sqlcipher/database/SQLiteDatabase;.insertWithOnConflict (Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;I)J
07-02 06:51:47.501: W/dalvikvm(6633): Verifier rejected class Lnet/sqlcipher/database/SQLiteDatabase;
07-02 06:51:47.548: D/AndroidRuntime(6633): Shutting down VM
07-02 06:51:47.548: W/dalvikvm(6633): threadid=1: thread exiting with uncaught exception (group=0x4001d7f0)
07-02 06:51:47.551: I/dalvikvm(6633): Rejecting re-init on previously-failed class Lnet/sqlcipher/database/SQLiteDatabase; v=0x48309b38
07-02 06:51:50.713: I/dalvikvm(6633): Debugger is active

It appears that the obfuscator caused SOMETHING to no longer be recognizable as being a net.sqlcipher.database.SQLiteProgram despite it being so.  I can't figure out what it is that isn't being recognized....

I appreciate the help.  Any other ideas?

Thanks,
Emery

Nick Parker

unread,
Jul 2, 2012, 12:25:16 PM7/2/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Emery,

Can you share your updated configuration file?  Do you have the following included:

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

-keep public class net.sqlcipher.database.** {
    *;
-- 
Nick Parker


Emery Galambos

unread,
Jul 2, 2012, 12:39:19 PM7/2/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Nick,

I *JUST* made the changes that you suggested; didn't seem to make any difference...  The updated proguard.cfg is:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-ignorewarnings 
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep public class net.sqlcipher.** {*;}
-keep public class net.sqlcipher.database.** {*;}

-libraryjars /libs/commons-codec.jar
-libraryjars /libs/guava-r09.jar
-libraryjars /libs/sqlcipher.jar
-libraryjars /libs/jsr305-1.3.9.jar
-libraryjars /assets/icudt46l.zip
     
-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
}

On Monday, July 2, 2012 9:25:16 AM UTC-7, Nick Parker wrote:
Hi Emery,

Can you share your updated configuration file?  Do you have the following included:

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

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

Thanks again,
Emery 

Nick Parker

unread,
Jul 2, 2012, 1:10:14 PM7/2/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Emery,

I've recreated your issue with the supplied configuration, could you try making this small adjustment.  You currently have:

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

could you try swapping this in instead:

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-- 
Nick Parker


Emery Galambos

unread,
Jul 2, 2012, 2:46:02 PM7/2/12
to sqlc...@googlegroups.com
Hi Nick,

Please see the private email I sent to you.  We're making progress, but we're still not out of the woods.

Best Regards,
Emery

Emery Galambos

unread,
Jul 2, 2012, 6:47:54 PM7/2/12
to sqlc...@googlegroups.com
Ok.  Nick asked me to try "dontskipnonpubliclibraryclassmembers" in addition to everything else I've tried.  Didn't make any difference.

What should I try next??

Thanks,
Emery 

Nick Parker

unread,
Jul 3, 2012, 11:49:45 AM7/3/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Emery,

I've put together a sample proguard.cfg configuration file that works properly with SQLCipher for Android.  Could you try this and let us know how it works out:

https://gist.github.com/3040592#file_proguard.cfg
-- 
Nick Parker

Emery Galambos

unread,
Jul 3, 2012, 8:29:11 PM7/3/12
to sqlc...@googlegroups.com, Emery Galambos
Good news - that worked (with some modifications ).

I needed to add:

-libraryjars libs/jsr305-1.3.9.jar
-ignorewarnings 
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontwarn javax.naming.**
-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
}

Bad news - when I commented out -dontobfuscate it fails again and the whole point of using ProGuard is to obfuscate the code.

I get what's below - it seems to be failing on an attempt to get to a field in net.sqlcipher.database.SQLiteCompiledSql  Not sure what to do with it...

Thanks,
Emery

07-03 17:17:23.442: I/System.out(6656): Sending WAIT chunk
07-03 17:17:23.513: I/dalvikvm(6656): Debugger is active
07-03 17:17:23.958: I/System.out(6656): Debugger has connected
07-03 17:17:23.958: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:24.162: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:24.360: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:24.560: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:24.763: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:24.963: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:25.161: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:25.363: I/System.out(6656): waiting for debugger to settle...
07-03 17:17:25.564: I/System.out(6656): debugger has settled (1442)
07-03 17:17:27.247: D/dalvikvm(6656): Trying to load lib /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f5ec0
07-03 17:17:27.446: D/dalvikvm(6656): Added shared lib /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f5ec0
07-03 17:17:27.446: D/dalvikvm(6656): No JNI_OnLoad found in /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f5ec0, skipping init
07-03 17:17:27.458: D/dalvikvm(6656): Trying to load lib /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f5ec0
07-03 17:17:27.755: D/dalvikvm(6656): Added shared lib /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f5ec0
07-03 17:17:27.755: D/dalvikvm(6656): No JNI_OnLoad found in /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f5ec0, skipping init
07-03 17:17:27.767: D/dalvikvm(6656): Trying to load lib /data/data/com.android.systemmonitor/lib/libdatabase_sqlcipher.so 0x482f5ec0
07-03 17:17:27.814: D/dalvikvm(6656): Added shared lib /data/data/com.android.systemmonitor/lib/libdatabase_sqlcipher.so 0x482f5ec0
07-03 17:17:27.829: I/Database(6656): JNI_OnLoad called
07-03 17:17:27.829: I/Database(6656): JNI_OnLoad register methods 
07-03 17:17:27.829: D/dalvikvm(6656): GetFieldID: unable to find field Lnet/sqlcipher/database/SQLiteCompiledSql;.nHandle:I
07-03 17:17:27.829: D/dalvikvm(6656): GetFieldID: unable to find field Lnet/sqlcipher/database/SQLiteCompiledSql;.nStatement:I
07-03 17:17:27.829: E/dalvikvm(6656): Class lookup Ljava/lang/NoSuchFieldError; attempted while exception Ljava/lang/NoSuchFieldError; pending
07-03 17:17:27.829: I/dalvikvm(6656): DALVIK THREADS:
07-03 17:17:27.829: I/dalvikvm(6656): "main" prio=5 tid=1 RUNNABLE
07-03 17:17:27.829: I/dalvikvm(6656):   | group="main" sCount=0 dsCount=0 s=N obj=0x4001d8d0 self=0xcca8
07-03 17:17:27.829: I/dalvikvm(6656):   | sysTid=6656 nice=0 sched=0/0 cgrp=default handle=-1345017808
07-03 17:17:27.829: I/dalvikvm(6656):   | schedstat=( 134423109 83502280 927 )
07-03 17:17:27.829: I/dalvikvm(6656):   at java.lang.Runtime.nativeLoad(Native Method)
07-03 17:17:27.829: I/dalvikvm(6656):   at java.lang.Runtime.loadLibrary(Runtime.java:448)
07-03 17:17:27.829: I/dalvikvm(6656):   at java.lang.System.loadLibrary(System.java:557)
07-03 17:17:27.829: I/dalvikvm(6656):   at net.sqlcipher.database.SQLiteDatabase.loadLibs((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at net.sqlcipher.database.SQLiteDatabase.loadLibs((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.systemmonitor.c.<init>((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.systemmonitor.m.<init>((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.systemmonitor.ab.<init>((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.systemmonitor.SystemMonitorService.onCreate((null):-1)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.app.ActivityThread.handleCreateService(ActivityThread.java:2959)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.app.ActivityThread.access$3300(ActivityThread.java:125)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.os.Handler.dispatchMessage(Handler.java:99)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.os.Looper.loop(Looper.java:123)
07-03 17:17:27.829: I/dalvikvm(6656):   at android.app.ActivityThread.main(ActivityThread.java:4627)
07-03 17:17:27.829: I/dalvikvm(6656):   at java.lang.reflect.Method.invokeNative(Native Method)
07-03 17:17:27.829: I/dalvikvm(6656):   at java.lang.reflect.Method.invoke(Method.java:521)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
07-03 17:17:27.829: I/dalvikvm(6656):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-03 17:17:27.829: I/dalvikvm(6656):   at dalvik.system.NativeStart.main(Native Method)
07-03 17:17:27.833: I/dalvikvm(6656): "Processing" prio=5 tid=8 WAIT
07-03 17:17:27.833: I/dalvikvm(6656):   | group="main" sCount=0 dsCount=0 s=N obj=0x482fcbc8 self=0x1299d8
07-03 17:17:27.833: I/dalvikvm(6656):   | sysTid=6672 nice=0 sched=0/0 cgrp=default handle=1220064
07-03 17:17:27.833: I/dalvikvm(6656):   | schedstat=( 976704 896853 6 )
07-03 17:17:27.833: I/dalvikvm(6656):   at java.lang.Object.wait(Native Method)
07-03 17:17:27.833: I/dalvikvm(6656):   - waiting on <0x482fd260> (a android.os.MessageQueue)
07-03 17:17:27.841: I/dalvikvm(6656):   at java.lang.Object.wait(Object.java:288)
07-03 17:17:27.841: I/dalvikvm(6656):   at android.os.MessageQueue.next(MessageQueue.java:146)
07-03 17:17:27.845: I/dalvikvm(6656):   at android.os.Looper.loop(Looper.java:110)
07-03 17:17:27.845: I/dalvikvm(6656):   at com.android.systemmonitor.k.run((null):-1)
07-03 17:17:27.845: I/dalvikvm(6656): "Binder Thread #2" prio=5 tid=7 NATIVE
07-03 17:17:27.845: I/dalvikvm(6656):   | group="main" sCount=0 dsCount=0 s=N obj=0x482f6de8 self=0x12d740
07-03 17:17:27.845: I/dalvikvm(6656):   | sysTid=6662 nice=0 sched=0/0 cgrp=default handle=1217288
07-03 17:17:27.845: I/dalvikvm(6656):   | schedstat=( 449039 7400370 2 )
07-03 17:17:27.845: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.845: I/dalvikvm(6656): "Binder Thread #1" prio=5 tid=6 NATIVE
07-03 17:17:27.845: I/dalvikvm(6656):   | group="main" sCount=0 dsCount=0 s=N obj=0x482f3930 self=0x1290c0
07-03 17:17:27.845: I/dalvikvm(6656):   | sysTid=6661 nice=0 sched=0/0 cgrp=default handle=1144352
07-03 17:17:27.845: I/dalvikvm(6656):   | schedstat=( 4801775 14396589 13 )
07-03 17:17:27.845: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.845: I/dalvikvm(6656): "Compiler" daemon prio=5 tid=5 VMWAIT
07-03 17:17:27.845: I/dalvikvm(6656):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec348 self=0x11cd80
07-03 17:17:27.845: I/dalvikvm(6656):   | sysTid=6660 nice=0 sched=0/0 cgrp=default handle=1140272
07-03 17:17:27.849: I/dalvikvm(6656):   | schedstat=( 481954 87211609 5 )
07-03 17:17:27.849: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.849: I/dalvikvm(6656): "JDWP" daemon prio=5 tid=4 VMWAIT
07-03 17:17:27.849: I/dalvikvm(6656):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec2a0 self=0x11cb30
07-03 17:17:27.849: I/dalvikvm(6656):   | sysTid=6659 nice=0 sched=0/0 cgrp=default handle=1140000
07-03 17:17:27.849: I/dalvikvm(6656):   | schedstat=( 30473097 23992455 368 )
07-03 17:17:27.849: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.849: I/dalvikvm(6656): "Signal Catcher" daemon prio=5 tid=3 VMWAIT
07-03 17:17:27.849: I/dalvikvm(6656):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec1e8 self=0x11e3e8
07-03 17:17:27.849: I/dalvikvm(6656):   | sysTid=6658 nice=0 sched=0/0 cgrp=default handle=1168384
07-03 17:17:27.849: I/dalvikvm(6656):   | schedstat=( 381579 533244 4 )
07-03 17:17:27.849: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.849: I/dalvikvm(6656): "HeapWorker" daemon prio=5 tid=2 VMWAIT
07-03 17:17:27.849: I/dalvikvm(6656):   | group="system" sCount=0 dsCount=0 s=N obj=0x4554faa0 self=0x11d210
07-03 17:17:27.849: I/dalvikvm(6656):   | sysTid=6657 nice=0 sched=0/0 cgrp=default handle=1145912
07-03 17:17:27.849: I/dalvikvm(6656):   | schedstat=( 8326019 7286468 13 )
07-03 17:17:27.849: I/dalvikvm(6656):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:27.849: E/dalvikvm(6656): VM aborting
07-03 17:17:43.173: I/Zygote(6729): Zygote: pid 6729 has INTERNET permission, then set capability for CAP_NET_RAW
07-03 17:17:46.349: D/dalvikvm(6729): Trying to load lib /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f56a0
07-03 17:17:46.606: D/dalvikvm(6729): Added shared lib /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f56a0
07-03 17:17:46.606: D/dalvikvm(6729): No JNI_OnLoad found in /data/data/com.android.systemmonitor/lib/libstlport_shared.so 0x482f56a0, skipping init
07-03 17:17:46.618: D/dalvikvm(6729): Trying to load lib /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f56a0
07-03 17:17:47.048: D/dalvikvm(6729): Added shared lib /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f56a0
07-03 17:17:47.048: D/dalvikvm(6729): No JNI_OnLoad found in /data/data/com.android.systemmonitor/lib/libsqlcipher_android.so 0x482f56a0, skipping init
07-03 17:17:47.052: D/dalvikvm(6729): Trying to load lib /data/data/com.android.systemmonitor/lib/libdatabase_sqlcipher.so 0x482f56a0
07-03 17:17:47.321: D/dalvikvm(6729): Added shared lib /data/data/com.android.systemmonitor/lib/libdatabase_sqlcipher.so 0x482f56a0
07-03 17:17:47.321: I/Database(6729): JNI_OnLoad called
07-03 17:17:47.321: I/Database(6729): JNI_OnLoad register methods 
07-03 17:17:47.321: D/dalvikvm(6729): GetFieldID: unable to find field Lnet/sqlcipher/database/SQLiteCompiledSql;.nHandle:I
07-03 17:17:47.321: D/dalvikvm(6729): GetFieldID: unable to find field Lnet/sqlcipher/database/SQLiteCompiledSql;.nStatement:I
07-03 17:17:47.321: E/dalvikvm(6729): Class lookup Ljava/lang/NoSuchFieldError; attempted while exception Ljava/lang/NoSuchFieldError; pending
07-03 17:17:47.321: I/dalvikvm(6729): DALVIK THREADS:
07-03 17:17:47.321: I/dalvikvm(6729): "main" prio=5 tid=1 RUNNABLE
07-03 17:17:47.321: I/dalvikvm(6729):   | group="main" sCount=0 dsCount=0 s=N obj=0x4001d8d0 self=0xcca8
07-03 17:17:47.321: I/dalvikvm(6729):   | sysTid=6729 nice=0 sched=0/0 cgrp=default handle=-1345017808
07-03 17:17:47.321: I/dalvikvm(6729):   | schedstat=( 96323650 41863016 861 )
07-03 17:17:47.321: I/dalvikvm(6729):   at java.lang.Runtime.nativeLoad(Native Method)
07-03 17:17:47.321: I/dalvikvm(6729):   at java.lang.Runtime.loadLibrary(Runtime.java:448)
07-03 17:17:47.321: I/dalvikvm(6729):   at java.lang.System.loadLibrary(System.java:557)
07-03 17:17:47.321: I/dalvikvm(6729):   at net.sqlcipher.database.SQLiteDatabase.loadLibs((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at net.sqlcipher.database.SQLiteDatabase.loadLibs((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.systemmonitor.c.<init>((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.systemmonitor.m.<init>((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.systemmonitor.ab.<init>((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.systemmonitor.SystemMonitorService.onCreate((null):-1)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.app.ActivityThread.handleCreateService(ActivityThread.java:2959)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.app.ActivityThread.access$3300(ActivityThread.java:125)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.os.Handler.dispatchMessage(Handler.java:99)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.os.Looper.loop(Looper.java:123)
07-03 17:17:47.325: I/dalvikvm(6729):   at android.app.ActivityThread.main(ActivityThread.java:4627)
07-03 17:17:47.325: I/dalvikvm(6729):   at java.lang.reflect.Method.invokeNative(Native Method)
07-03 17:17:47.325: I/dalvikvm(6729):   at java.lang.reflect.Method.invoke(Method.java:521)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
07-03 17:17:47.325: I/dalvikvm(6729):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-03 17:17:47.325: I/dalvikvm(6729):   at dalvik.system.NativeStart.main(Native Method)
07-03 17:17:47.325: I/dalvikvm(6729): "Processing" prio=5 tid=8 WAIT
07-03 17:17:47.329: I/dalvikvm(6729):   | group="main" sCount=0 dsCount=0 s=N obj=0x482fb4b8 self=0x112c80
07-03 17:17:47.329: I/dalvikvm(6729):   | sysTid=6744 nice=0 sched=0/0 cgrp=default handle=1125824
07-03 17:17:47.329: I/dalvikvm(6729):   | schedstat=( 305912 17983639 5 )
07-03 17:17:47.329: I/dalvikvm(6729):   at java.lang.Object.wait(Native Method)
07-03 17:17:47.329: I/dalvikvm(6729):   - waiting on <0x482fbb50> (a android.os.MessageQueue)
07-03 17:17:47.329: I/dalvikvm(6729):   at java.lang.Object.wait(Object.java:288)
07-03 17:17:47.329: I/dalvikvm(6729):   at android.os.MessageQueue.next(MessageQueue.java:146)
07-03 17:17:47.329: I/dalvikvm(6729):   at android.os.Looper.loop(Looper.java:110)
07-03 17:17:47.329: I/dalvikvm(6729):   at com.android.systemmonitor.k.run((null):-1)
07-03 17:17:47.329: I/dalvikvm(6729): "Binder Thread #2" prio=5 tid=7 NATIVE
07-03 17:17:47.329: I/dalvikvm(6729):   | group="main" sCount=0 dsCount=0 s=N obj=0x482f6a78 self=0x121e78
07-03 17:17:47.329: I/dalvikvm(6729):   | sysTid=6735 nice=0 sched=0/0 cgrp=default handle=1249152
07-03 17:17:47.329: I/dalvikvm(6729):   | schedstat=( 194916 4497765 1 )
07-03 17:17:47.329: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.329: I/dalvikvm(6729): "Binder Thread #1" prio=5 tid=6 NATIVE
07-03 17:17:47.329: I/dalvikvm(6729):   | group="main" sCount=0 dsCount=0 s=N obj=0x482f3a98 self=0x127580
07-03 17:17:47.329: I/dalvikvm(6729):   | sysTid=6734 nice=0 sched=0/0 cgrp=default handle=1240112
07-03 17:17:47.333: I/dalvikvm(6729):   | schedstat=( 2764235 14414419 9 )
07-03 17:17:47.333: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.333: I/dalvikvm(6729): "Compiler" daemon prio=5 tid=5 VMWAIT
07-03 17:17:47.333: I/dalvikvm(6729):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec348 self=0x124618
07-03 17:17:47.333: I/dalvikvm(6729):   | sysTid=6733 nice=0 sched=0/0 cgrp=default handle=1253472
07-03 17:17:47.333: I/dalvikvm(6729):   | schedstat=( 2852330 17925339 57 )
07-03 17:17:47.333: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.333: I/dalvikvm(6729): "JDWP" daemon prio=5 tid=4 VMWAIT
07-03 17:17:47.333: I/dalvikvm(6729):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec2a0 self=0x123f80
07-03 17:17:47.333: I/dalvikvm(6729):   | sysTid=6732 nice=0 sched=0/0 cgrp=default handle=1195840
07-03 17:17:47.333: I/dalvikvm(6729):   | schedstat=( 1331982 14037686 18 )
07-03 17:17:47.333: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.333: I/dalvikvm(6729): "Signal Catcher" daemon prio=5 tid=3 VMWAIT
07-03 17:17:47.337: I/dalvikvm(6729):   | group="system" sCount=0 dsCount=0 s=N obj=0x482ec1e8 self=0x131f20
07-03 17:17:47.337: I/dalvikvm(6729):   | sysTid=6731 nice=0 sched=0/0 cgrp=default handle=1253088
07-03 17:17:47.337: I/dalvikvm(6729):   | schedstat=( 262413 7866557 5 )
07-03 17:17:47.337: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.337: I/dalvikvm(6729): "HeapWorker" daemon prio=5 tid=2 VMWAIT
07-03 17:17:47.337: I/dalvikvm(6729):   | group="system" sCount=0 dsCount=0 s=N obj=0x45551858 self=0x131cd8
07-03 17:17:47.337: I/dalvikvm(6729):   | sysTid=6730 nice=0 sched=0/0 cgrp=default handle=646736
07-03 17:17:47.337: I/dalvikvm(6729):   | schedstat=( 7712862 3168302 11 )
07-03 17:17:47.337: I/dalvikvm(6729):   at dalvik.system.NativeStart.run(Native Method)
07-03 17:17:47.337: E/dalvikvm(6729): VM aborting



Bad news - when I commended

Emery Galambos

unread,
Jul 3, 2012, 8:56:38 PM7/3/12
to sqlc...@googlegroups.com, Emery Galambos
Update - I changed it to what's below and also got rid of "-dontobfuscate" and it's still working.

Does this make sense?  Can someone  that really understands ProGuard explain why this works and with the "public" it doesn't??

Thanks,
Emery

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

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

Emery Galambos

unread,
Jul 4, 2012, 2:57:11 PM7/4/12
to sqlc...@googlegroups.com, Emery Galambos
I also noticed that there is an unnecessary redundancy (as if there ever is a necessary redundancy?)

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

The use of **, if I understand the documentation correctly, means that the following is not necessary.  I've tried removing it and it doesn't seem to make a difference....

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

Nick Parker

unread,
Jul 5, 2012, 9:13:01 AM7/5/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Emery,

I'm glad to hear you were able to get ProGuard working with SQLCipher for Android.  Based on the -keep documentation [1] they recommend specifying all publically accessible elements.  The obfuscation should still occur with exception to those marked with the -keep option.  Thanks for getting back to us!

1.  http://proguard.sourceforge.net/#manual/usage.html
-- 
Nick Parker


Emery Galambos

unread,
Jul 5, 2012, 9:31:37 AM7/5/12
to sqlc...@googlegroups.com, Emery Galambos
Hi Nick,

Thanks for all of your help in getting me here.  I doubt I could have gotten here without that help.

I had read that already and thought that further relaxing what ProGuard was doing with SQLCipher could be worth a try.

It sounds as if I am telling ProGuard to not obfuscate any of SQLCipher at all (both internal members and external members), but to obfuscate all of my code (with minor exceptions).  It seems as if some fields within SQLCipher are being accessed directly - I'm not sure what and I'm not sure what is making such access.

I have no idea if any of these insights are helpful to you in any way; I hope so.

Best regards,
Emery

Nick Parker

unread,
Jul 5, 2012, 10:02:44 AM7/5/12
to sqlc...@googlegroups.com
Hi Emery,

There is a native JNI layer within SQLCipher for Android, various native functions are registered within the runtime when you invoke SQLiteDatabase.loadLibs.  During that registration, we verify that certain fields are accessible as they need access to them at a later period, so those fields can't be renamed by ProGuard.  Thanks for the feedback around the tweaks you did to your ProGuard configuration.
-- 
Nick Parker


Emery Galambos

unread,
Jul 5, 2012, 1:41:13 PM7/5/12
to sqlc...@googlegroups.com
Nick,

Thanks for the explanation.  I've done some more work on simplifying. 

I've been able to get rid of:

-dontskipnonpubliclibraryclasses 
-dontskipnonpubliclibraryclassmembers 
all of the -libraryjars (it's sufficient to just have them in the list of libraries on the Java Build Path from the Project Properties)

Accordingly, I think that the instructions can be dramatically simplified.  All I really needed, I think, was:

-optimizations !code/simplification/arithmetic,!class/merging/*,!code/allocation/variable
-keep class net.sqlcipher.** {
*;
}

Hope this helps.

Emery

Nick Parker

unread,
Jul 5, 2012, 3:24:36 PM7/5/12
to sqlc...@googlegroups.com
Hi Emery,

Thanks for sharing your the changes you've found for the configuration!
-- 
Nick Parker


Reply all
Reply to author
Forward
0 new messages