nuh*_*oca 6 android functional-programming gradle android-gradle-plugin android-proguard
我正在Android Studio中开发一个应用程序,并且想向我的应用程序添加proguard。但是我不知道该怎么办?我也想学习它的上下文。谁能给我看些东西?谢谢。
在您的gradle文件中设置true为minifyEnabled
您可以定义是否在调试和/或发布中启用了proguard
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
}
Run Code Online (Sandbox Code Playgroud)
您还可以设置proguardFiles对其进行配置,请访问此站点以查看有关它的文档,请看以下示例:
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/balysv/Documents/Android/sdk/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 *;
#}
-optimizationpasses 5
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
Run Code Online (Sandbox Code Playgroud)
如果要使用自定义词典进行代码混淆,请使用字典文件设置此配置:
-obfuscationdictionary proguard-dic.txt
-classobfuscationdictionary proguard-dic.txt
-packageobfuscationdictionary proguard-dic.txt
Run Code Online (Sandbox Code Playgroud)
字典文件是一个简单的文本文件,其中包含要用于混淆代码的标签,每行1个标签。
| 归档时间: |
|
| 查看次数: |
12571 次 |
| 最近记录: |