gpt4 book ai didi

android - Android build.gradle 中的 proguard-android-optimize.txt 与 proguard-android.txt

转载 作者:行者123 更新时间:2023-12-03 13:25:15 44 4
gpt4 key购买 nike

我正在阅读 the docs about shrinking, obfuscating and optimising for a release build using build.gradle for an Android app .在文档的一部分中, proguard-android.txt 用作默认的 ProGuard 文件:

android {
...
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}

在另一部分中, proguard-android-optimize.txt 用来:
android {
...
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
}

似乎没有解释这些之间的区别,我找不到任何信息。谁能解释一下有什么区别以及何时使用 proguard-android-optimize.txt 对比 proguard-android.txt ?

谢谢 :)

最佳答案

看看here上的Android源代码.

Optimizations: If you don't want to optimize, use the proguard-android.txt configuration file instead of this one, which turns off the optimization flags. Adding optimization introduces certain risks, since for example not all optimizations performed by ProGuard works on all versions of Dalvik. The following flags turn off various optimizations known to have issues, but the list may not be complete or up to date. (The "arithmetic" optimization can be used if you are only targeting Android 2.0 or later.) Make sure you test thoroughly if you go this route.



另外,这个 answer也是一本不错的读物。

关于android - Android build.gradle 中的 proguard-android-optimize.txt 与 proguard-android.txt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56902356/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com