1

I'm using @CommonsWare's CWAC-LoaderEx library and its SQLiteCursorLoader in my application.

But when I try to use Proguard, I got the following warnings:

Warning: com.commonsware.cwac.loaderex.SQLCipherCursorLoader: can't find referenced class net.sqlcipher.database.SQLiteOpenHelper
Warning: com.commonsware.cwac.loaderex.SQLCipherCursorLoader$DeleteTask: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.SQLCipherCursorLoader$InsertTask: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.SQLCipherCursorLoader$ReplaceTask: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.SQLCipherCursorLoader$UpdateTask: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.SQLCipherUtils: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.SQLCipherUtils: can't find referenced class net.sqlcipher.database.SQLiteDatabase$CursorFactory
Warning: com.commonsware.cwac.loaderex.acl.SQLCipherCursorLoader: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning: com.commonsware.cwac.loaderex.acl.SQLCipherCursorLoader$DeleteTask: can't find referenced class net.sqlcipher.database.SQLiteDatabase

... and so on. I have tried adding to my proguardcfg file:

-libraryjars libs/CWAC-LoaderEx.jar
-keep class net.sqlcipher.** { *; }
-keep class net.sqlcipher.database.** { *; }

besides the default proguard-android.txt, included in the SDK.

Does anyone have any ideas? Thanks!

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
leocadiotine
  • 3,295
  • 2
  • 22
  • 19
  • 1
    This will probably sound like a silly question, but do you have SQLCipher for Android in the project? CWAC-LoaderEx *uses* SQLCipher for Android, and the demo app has a copy of it, but the CWAC-LoaderEx JAR does not include SQLCipher itself. – CommonsWare Oct 17 '13 at 22:50
  • That's not a silly question at all, because I don't have SQLCipher in the project! That will, probably, solve the problem, will try right now. Another question: since I'm not using SQLCipher, can I just tell Proguard to ignore it? Because the app works fine in debug mode. – leocadiotine Oct 17 '13 at 23:39

2 Answers2

3

If your application isn't using SQLCipher, you can tell ProGuard to ignore the missing classes. For instance:

-dontwarn net.sqlcipher.**

See the ProGuard manual > Troubleshooting > Warning: can't find referenced class.

You shouldn't specify -injars or -libraryjars options in your configuration file. The Ant/Eclipse/Gradle build process already automatically specifies all the necessary -injars, -outjars, and -libraryjars for you, based on the contents of your project.

See the ProGuard manual > Troubleshooting > Note: duplicate definition of program/library class

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
1

since I'm not using SQLCipher, can I just tell Proguard to ignore it?

You can tell ProGuard to get rid of com.commonsware.cwac.loaderex.SQLCipherCursorLoader, presumably.

The warnings are just that: warnings. I assumed (incorrectly) that you were crashing in addition to the warnings. So long as you never tried using SQLCipherCursorLoader, the warnings would not cause you any particular problems.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491