android studio不混淆jar,Android Studio代碼混淆-第三方jar混淆匯總(持續更新)

前言

Android有非常多的優秀的第三方開源jar包,我們經常在我們的項目中使用了不少jar包,但是往往到了release的時候就忘了混淆第三方jar包了,會給我們開發帶來不少麻煩,所有在這里匯總一下一些比較熱門的第三方jar包的混淆方式,方便大家開發。本篇文章會持續更新,如果你有其它jar包的混淆使用方式也可以告知我,以便可以更好的為大家提供一份較為完整實例。

本博客同步發布於 XueLong的博客

常用第三方開源jar包

排名不分先后(按首字母順序排列)

Android-gif-drawable 鏈接-keep public class pl.droidsonroids.gif.GifIOException{(int);}

-keep class pl.droidsonroids.gif.GifInfoHandle{(long,int,int,int);}

Android-Universal-Image-Loader 鏈接#Universal Image Loader

-keep class com.nostra13.universalimageloader.** { *; }

-keepattributes Signature

ButterKnife 鏈接-keep class butterknife.** { *; }

-dontwarn butterknife.internal.**

-keep class **$$ViewBinder { *; }

-keep class **$$ViewInjector

-keepclasseswithmembernames class * {

@butterknife.* ;

}

-keepclasseswithmembernames class * {

@butterknife.* ;

}

Bugly 鏈接-keep public class com.tencent.bugly.**{*;}

EventBus 鏈接-keepclassmembers class ** {

public void onEvent*(***);

}

# Only required if you use AsyncExecutor

-keepclassmembers class * extends de.greenrobot.event.util.ThrowableFailureEvent {

public (java.lang.Throwable);

}

# Don't warn for missing support classes

-dontwarn de.greenrobot.event.util.*$Support

-dontwarn de.greenrobot.event.util.*$SupportManagerFragment

Fabric Twitter Kit 鏈接-dontwarn com.squareup.okhttp.**

-dontwarn com.google.appengine.api.urlfetch.**

-dontwarn rx.**

-dontwarn retrofit.**

-keepattributes Signature

-keepattributes *Annotation*

-keep class com.squareup.okhttp.** { *; }

-keep interface com.squareup.okhttp.** { *; }

-keep class retrofit.** { *; }

-keepclasseswithmembers class * {

@retrofit.http.* *;

}

Fastjson 鏈接-dontwarn com.alibaba.fastjson.**

-keepattributes Signature

-keepattributes *Annotation*

Glide 鏈接-keep public class * implements com.bumptech.glide.module.GlideModule

-keep public class * extends com.bumptech.glide.AppGlideModule

-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {

**[] $VALUES;

public *;

}

# for DexGuard only

-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

Gson 鏈接# Gson uses generic type information stored in a class file when working with fields. Proguard

# removes such information by default, so configure it to keep all of it.

-keepattributes Signature

# For using GSON @Expose annotation

-keepattributes *Annotation*

# Gson specific classes

-keep class sun.misc.Unsafe { *; }

#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson

-keep class com.google.gson.examples.android.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,

# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)

-keep class * implements com.google.gson.TypeAdapterFactory

-keep class * implements com.google.gson.JsonSerializer

-keep class * implements com.google.gson.JsonDeserializer

環信SDK 鏈接-keep class com.easemob.** {*;}

-keep class org.jivesoftware.** {*;}

-keep class org.apache.** {*;}

-dontwarn com.easemob.**

#2.0.9后的不需要加下面這個keep

#-keep class org.xbill.DNS.** {*;}

#另外,demo中發送表情的時候使用到反射,需要keep SmileUtils

-keep class com.easemob.chatuidemo.utils.SmileUtils {*;}

#注意前面的包名,如果把這個類復制到自己的項目底下,比如放在com.example.utils底下,應該這么寫(實際要去掉#)

#-keep class com.example.utils.SmileUtils {*;}

#如果使用easeui庫,需要這么寫

-keep class com.easemob.easeui.utils.EaseSmileUtils {*;}

#2.0.9后加入語音通話功能,如需使用此功能的api,加入以下keep

-dontwarn ch.imvs.**

-dontwarn org.slf4j.**

-keep class org.ice4j.** {*;}

-keep class net.java.sip.** {*;}

-keep class org.webrtc.voiceengine.** {*;}

-keep class org.bitlet.** {*;}

-keep class org.slf4j.** {*;}

-keep class ch.imvs.** {*;}

LitePal 鏈接-keep class org.litepal.** {

*;

}

-keep class * extends org.litepal.crud.DataSupport {

*;

}

Okhttp 鏈接-keepattributes Signature

-keepattributes *Annotation*

-keep class okhttp3.** { *; }

-keep interface okhttp3.** { *; }

-dontwarn okhttp3.**

OkhttpUtils 鏈接#okhttputils

-dontwarn com.zhy.http.**

-keep class com.zhy.http.**{*;}

#okhttp

-dontwarn okhttp3.**

-keep class okhttp3.**{*;}

#okio

-dontwarn okio.**

-keep class okio.**{*;}

Picasso 鏈接-dontwarn com.squareup.okhttp.**

Retrofit2 鏈接-dontwarn retrofit2.**

-keep class retrofit2.** { *; }

-keepattributes Signature

-keepattributes Exceptions

-keepclasseswithmembers class * {

@retrofit2.http.* ;

}

RxJava 鏈接-keep class rx.schedulers.Schedulers {

public static ;

}

-keep class rx.schedulers.ImmediateScheduler {

public ;

}

-keep class rx.schedulers.TestScheduler {

public ;

}

-keep class rx.schedulers.Schedulers {

public static ** test();

}

ShareSDK 鏈接-keep class cn.sharesdk.**{*;}

-keep class com.sina.**{*;}

-keep class **.R$* {*;}

-keep class **.R{*;}

-dontwarn cn.sharesdk.**

-dontwarn **.R$*

-dontwarn com.tencent.**

-keep class com.tencent.** {*;}

SlidingMenu 鏈接-dontwarn com.jeremyfeinstein.slidingmenu.lib.**

-keep class com.jeremyfeinstein.slidingmenu.lib.**{*;}

補充幾個非常不錯的代碼混淆相關的開源項目

AndResGuard 鏈接

Android 源混淆

android-proguard-snippets 鏈接

一個更棒的項目,幾乎整合了所有常見的第三方jar包的混淆方式。

寫在最后

以上就是目前所整理的第三方開源jar包的代碼混淆方式,如果你有其他的jar包的使用方式可以給我留言,我會添加上去。

如果你在參考過程中遇到問題,可以在我的聯系方式中給我提問。

后面會繼續介紹,Android的相關知識,歡迎繼續關注我博客的更新。

參考資源

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值