Home  >  Q&A  >  body text

android 混淆代码问题

在混淆我的工程代码中,出现了“multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.”错误提示。下面是我的proguard-rules.pro文件。

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\ProgramFiles\AndroidSDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontskipnonpubliclibraryclasses
-dontpreverify

-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontwarn android.support.v4.**
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keepattributes *Annotation*
-keep public class * extends android.app.Activity
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v4.app.FragmentActivity
-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 * extends blockcheng.BssicAct
-keep public class * extends blockcheng.controller.BCFragment
-keep public class com.android.vending.licensing.ILicensingService

#android-support-v4
-libraryjars libs/android-support-v4.jar
-dontwarn android.support.v4.**
-keep class android.support.v4.**{*;}

#百度
-keep class com.baidu.** {*;}
-keep class vi.com.** {*;}
-dontwarn com.baidu.**
#融云
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 public *;
}
-keepattributes Exceptions,InnerClasses
-keep class io.rong.** {*;}
-keep class * implements io.rong.imlib.model.MessageContent{*;}
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.examples.android.model.** { *; }
-keepclassmembers class * extends com.sea_monster.dao.AbstractDao {
 public static java.lang.String TABLENAME;
}
-keep class **$Properties
-dontwarn org.eclipse.jdt.annotation.**
-keep class com.ultrapower.** {*;}

#如果引用了v4或者v7包
-dontwarn android.support.**

-keep public class * implements java.io.Serializable {
        public *;
}

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

#fastjson-1.2.5.jar
-libraryjars libs/fastjson-1.2.5.jar
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.**{*;}

#systembartint-1.0.4.jar
-libraryjars libs/systembartint-1.0.4.jar
-keep class com.readystatesoftware.systembartint.** {*;}
-dontwarn com.readystatesoftware.systembartint.**

#Vitamio
-keep class io.vov.utils.** { *; }
-keep class io.vov.vitamio.** { *; }

#pulltorefresh
-dontwarn com.handmark.pulltorefresh.library.**
-keep class com.handmark.pulltorefresh.library.** { *;}
-dontwarn com.handmark.pulltorefresh.library.extras.**
-keep class com.handmark.pulltorefresh.library.extras.** { *;}
-dontwarn com.handmark.pulltorefresh.library.internal.**
-keep class com.handmark.pulltorefresh.library.internal.** { *;}

#devsmartAndroid
-keep class com.** {*;}
-dontwarn com.**

#gson
-libraryjars libs/gson-2.2.4.jar
-keepattributes Signature
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

#避免混淆泛型 如果混淆报错建议关掉
#–keepattributes Signature

#不混淆资源类
-keepclassmembers class **.R$* {
    public static <fields>;
}

#okhttputils
-dontwarn com.zhy.http.**
-keep class com.zhy.http.**{*;}
-keep interface com.zhy.http.**{*;}

#okhttp
-dontwarn okhttp3.**
-keep class okhttp3.**{*;}
-keep interface okhttp3.**{*;}

#okio
-dontwarn okio.**
-keep class okio.**{*;}
-keep interface okio.**{*;}

#universal-image-loader
-libraryjars libs/universal-image-loader-1.9.4-with-sources.jar
-dontwarn com.nostra13.universalimageloader.**
-keep class com.nostra13.universalimageloader.**{*;}

用到的jar包我貌似都放进去了,请问是怎么回事?

巴扎黑巴扎黑2763 days ago486

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 16:13:47

    -dontwarn android.support.v4.**
    

    It looks like this is a duplicate configuration, so delete it.

    -dontwarn android.support.**
    

    This line of configuration already meets the configuration of all your support packages.

    reply
    0
  • Cancelreply