关闭

android中的代码混淆

标签: 代码混淆
220人阅读 评论(0) 收藏 举报
分类:

代码混淆应注意,保留不被混淆的第三方jar包以及工具类
在project.properties中修改一下几点
proguard.config=proguard-project.txt

Project target.

target=android-14
android.library.reference.1=../../æžå®¢å­¦é™¢å­¦ä¹ ä»£ç /demo-project-eclipse-master/IMKit/src/main

//在proguard-project文件中配置一下文件

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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 *;
#}

-keep class org.apache.**{ *; }
-keep class com.baidu.**{ *; }
-optimizationpasses 5  
-dontusemixedcaseclassnames  
-dontskipnonpubliclibraryclasses  
-dontpreverify  
-verbose  
-ignorewarnings
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*  
-keepattributes *Annotation*  
-keepattributes Signature  

-keep public class * extends android.app.Fragment 
-keep public class * extends android.app.Activity
-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 android.support.v4.**
-keep public class com.android.vending.licensing.ILicensingService

-keep class com.baidu.** { *; }
-keep class vi.com.gdi.bgl.android.**{*;}

#主类继承的Activity
-keep class * extends com.lcjl.autolayout.AutoLayoutActivity
#封装类避免被混淆
-keep class com.example.bean.** { *; }

-dontoptimize
-dontpreverify
#极光推送
-dontwarn cn.jpush.**
-keep class cn.jpush.** { *; }

-dontwarn com.google.**
-keep class com.google.gson.** {*;}
-keep class com.google.protobuf.** {*;}

#自己定义的回调接口
#自己定义的工具类
-keepclasseswithmembers class com.example.utils.**{ 
     <fields>;
     <methods>;
}

-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 public *;
}

-keepclasseswithmembers class * {                                               
        public <init>(android.content.Context, android.util.AttributeSet);  
}  
-keepclasseswithmembers class * {  
        public <init>(android.content.Context, android.util.AttributeSet, int);     
}  

-keepclassmembers class * extends android.app.Activity {                       
       public void *(android.view.View);  
}  

#融云服务
-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.** {*;}

#第三方类库避免混淆
-libraryjars ..\PullRefreshLibrary
-dontwarn com.handmark.pulltorefresh.library.**
-keep class com.handmark.pulltorefresh.library.** { *;}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:18321次
    • 积分:660
    • 等级:
    • 排名:千里之外
    • 原创:41篇
    • 转载:4篇
    • 译文:8篇
    • 评论:4条