cwac-loaderex和Proguard

时间:2013-10-17 22:41:38

标签: android android-sqlite proguard commonsware-cwac

我在我的应用程序中使用@ CommonsWare的CWAC-LoaderEx库及其SQLiteCursorLoader

但是当我尝试使用Proguard时,我收到了以下警告:

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

......等等。我已尝试添加到我的proguardcfg文件中:

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

除了SDK中包含的默认proguard-android.txt

有没有人有任何想法? 谢谢!

2 个答案:

答案 0 :(得分:3)

如果您的应用程序未使用SQLCipher,您可以告诉ProGuard忽略缺少的类。例如:

-dontwarn net.sqlcipher.**

请参阅ProGuard手册>疑难解答> Warning: can't find referenced class

您不应在配置文件中指定-injars-libraryjars选项。 Ant / Eclipse / Gradle构建过程已根据项目内容自动为您指定所有必需的-injars-outjars-libraryjars

请参阅ProGuard手册>疑难解答> Note: duplicate definition of program/library class

答案 1 :(得分:1)

  

因为我没有使用SQLCipher,我可以告诉Proguard忽略它吗?

你可以告诉ProGuard摆脱com.commonsware.cwac.loaderex.SQLCipherCursorLoader,大概是。

警告就是:警告。我假设(错误地)除了警告之外你还在崩溃。只要您从未尝试使用SQLCipherCursorLoader,警告就不会给您带来任何特殊问题。