android中的代码混淆

代码混淆应注意,保留不被混淆的第三方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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值