Java ProGuard配置文件不工作
试图在项目中使用Proguard进行收缩、优化和模糊处理 我在我的项目中使用以下外部库Java ProGuard配置文件不工作,java,android,proguard,Java,Android,Proguard,试图在项目中使用Proguard进行收缩、优化和模糊处理 我在我的项目中使用以下外部库 - ActionBarSherlok : com.actionbarsherlock - SherlokNavigationDrawer : com.sherlock.navigationdrawer - GoogleplayLib : com.google.android.gms - ViewPagerIndicator : com.viewpage
- ActionBarSherlok : com.actionbarsherlock
- SherlokNavigationDrawer : com.sherlock.navigationdrawer
- GoogleplayLib : com.google.android.gms
- ViewPagerIndicator : com.viewpagerindicator
- MyAppPackage : ...
- External Jar used are
- HttpMime :
- GoogleAnalytics
- Crittercism
- UniversalImageLoader
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# repackage and optimize
-repackageclasses "com.example.data"
# Keep a fixed source file attribute and all line number tables to get line
# numbers in the stack traces.
# You can comment this out if you're not interested in stack traces.
#-renamesourcefileattribute SourceFile
#-keepattributes SourceFile,LineNumberTable
# keep annotations
-keepattributes *Annotation*
# keep the licencing service classes from Google
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# an example on how to keep an entire package
# -keep class com.google.zxing.**
#############################################################################
#-keep class com.data.metro.services.**
-keep class com.actionbarsherlock.** { *; }
-keep class com.sherlock.navigationdrawer.** { *; }
-keep class com.viewpagerindicator.** { *; }
-libraryjars libs
-keep class crittercism.sdk.** { *; }
-keep class crittercism.android.** { *; }
-keep class org.apache.http.entity.mime.** { *; }
-keep class google.ads.** { *; }
-keep class google.analytics** { *; }
-keep class google.android.gms.** { *; }
-keep class google.tagmanager.** { *; }
-keep class com.nostra13.universalimageloader.** { *; }
#############################################################################
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
# an example if you don't want to be warned about missing libraries
# -dontwarn javax.naming.**
#############################################################################
# remove logging, note that this removes ALL logging, including the
# Log.e statements
-assumenosideeffects class android.util.Log {
*;
}
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
#-optimizationpasses 5
#-allowaccessmodification
#-dontpreverify
-ActionBarSherlok:com.actionbarsherlock
-SherlokanavigationDrawer:com.sherlock.navigationdrawer
-GoogleplayLib:com.google.android.gms
-ViewPagerIndicator:com.ViewPagerIndicator
-MyAppPackage:。。。
-使用的外部罐是
-httpime:
-谷歌分析
-批判
-通用图像加载器
#这是ProGuard的配置文件。
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-DontskipnonPublicLibraryClass
-冗长的
#重新包装和优化
-重新打包类“com.example.data”
#保留一个固定的源文件属性和所有行号表以获取行
#堆栈跟踪中的数字。
#如果您对堆栈跟踪不感兴趣,可以对此进行注释。
#-重命名SourceFileAttribute源文件
#-keepattributes源文件,LineNumberTable
#保留注释
-keepattributes*注释*
#保留来自谷歌的许可服务类
-保持公共类com.google.vending.licensing.ILicensingService
-保持公共类com.android.vending.licensing.ILicensingService
#有关本机方法,请参见http://proguard.sourceforge.net/manual/examples.html#native
-KeepClassSwithMemberNames类*{
本地人;
}
#在视图中保留setter,以便动画仍然可以工作。
#看http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers公共类*扩展了android.view.view{
无效集*(***);
***得到*();
}
#我们希望在活动中保留可以在XML属性onClick中使用的方法
-keepclassmembers类*扩展了android.app.Activity{
public void*(android.view.view);
}
#有关枚举类,请参见http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers枚举*{
公共静态**[]值();
公共静态**valueOf(java.lang.String);
}
-keep class*实现android.os.Parcelable{
公开静态最终android.os.Parcelable$Creator*;
}
-keepclassmembers类**.R$*{
公共静态;
}
#关于如何保存整个包的示例
#-保持类com.google.zxing**
#############################################################################
#-保留com.data.metro.services类**
-保持类com.actionbarsherlock.*{*;}
-保持类com.sherlock.navigationdrawer.*{*;}
-保留类com.viewpagerindicator.*{*;}
-图书馆馆藏
-keep class critercism.sdk.*{*;}
-keep class critercism.android.*{*;}
-保持类org.apache.http.entity.mime.*{*;}
-保持类google.ads.*{*;}
-保持类google.analytics**{*;}
-保持类google.android.gms.*{*;}
-保留类google.tagmanager.*{*;}
-保持类com.nostra13.universalimageloader.*{*;}
#############################################################################
#支持库包含对较新平台版本的引用。
#如果此应用程序链接的是较旧的应用程序,请不要警告这些问题
#平台版本。我们知道他们,他们是安全的。
-dontwarn android.support**
#如果您不想被警告丢失库,请举个例子
#-dontwarn javax.naming**
#############################################################################
#删除日志记录,请注意,这将删除所有日志记录,包括
#Log.e语句
-assumenosideeffects类android.util.Log{
*;
}
#-优化!代码/简化/算术,!代码/简化/转换,!字段/*,!类/合并/*
#-优化过程5
#-允许访问修改
#-不要翻转
导出应用程序后,它根本不工作。
原因是代码没有适当地收缩,它也删除了一些使用过的代码,当我看到使用dex2jar和jdgui的代码时发现了这一点
需要建议,此proguard.cfg配置文件中需要进行哪些更改。我认为您需要在proguard文件中添加行,以告知收缩所有有用的代码 所以,要包含SherLock代码,您需要在Proguard中添加所有有用的类
-keep class com.example.classname.**{
*;
}
-keep interface com.example.classname.**{
*;
}
并包括线下使用的罐子
-injars bin/classes
-injars libs
-outjars bin/classes-processed.jar
-libraryjars /libs/nameofjarfile.jar
就像上面这几行
希望它能帮助你。
请尝试让我知道我认为您需要导入库以进行正确编译。尝试使用以下参数(例如):
-injars libary1.jar
-libraryjars '/Java/jre6/lib/rt.jar'