Android 代码混淆语法讲解及常用模板,flutter二维码识别

至于它是

《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》

【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享

怎样指定 proguard-rules.pro 文件来配置代码混淆的,我们可以在看一下 build.gradle 是怎样配置的

// 对正式版的进行混淆配置

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’

}

}

了解了在哪里配置混淆代码之后,下面我们一起来看一下怎样混淆代码

首先,我们先来看一下 Android 默认的代码混淆配置,在 {SDKHOME}\tools\proguard 目录下,有 proguard-android.txt 文件,该文件就是默认的代码混淆配置

This is a configuration file for ProGuard.

http://proguard.sourceforge.net/index.html#manual/usage.html

-dontusemixedcaseclassnames

-dontskipnonpubliclibraryclasses

-verbose

Optimization is turned off by default. Dex does not like code run

through the ProGuard optimize and preverify steps (and performs some

of these optimizations on its own).

-dontoptimize

-dontpreverify

Note that if you want to enable optimization, you cannot just

include optimization flags in your own project configuration file;

instead you will need to point to the

“proguard-android-optimize.txt” file instead of this one from your

project.properties file.

-keepattributes Annotation

-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 ;

}

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);

}

-keepclassmembers class * implements android.os.Parcelable {

public static final android.os.Parcelable$Creator CREATOR;

}

-keepclassmembers class *.R$ {

public static ;

}

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.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值