ProGuard配置文件不起作用



试图在项目中使用Proguard进行收缩、优化和混淆。

我在我的项目中使用以下外部库。

     - 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

导出应用程序后,它根本不起作用。原因是代码没有正确收缩,它也删除了一些使用过的代码,当我看到使用dex2jar和jdgui的代码时,我发现了这一点。

需要建议,此proguard.cfg Cofiguration文件中需要进行哪些更改。

我认为您需要在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'

相关内容

  • 没有找到相关文章

最新更新