gpt4 book ai didi

android - proguard-android.txt 和 proguard-rules.pro 有什么区别? - 安卓

转载 作者:IT老高 更新时间:2023-10-28 22:02:48 51 4
gpt4 key购买 nike

在我的 buildType 中,我看到了这个:

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

我有一些问题:

  1. 为什么会有两个文件?
  2. 它们之间有什么区别?
  3. 我应该在哪里写我的规则?

最佳答案

The getDefaultProguardFile('proguard-android.txt') method obtains the default ProGuard settings from the Android SDK tools/proguard/ folder. The proguard-android-optimize.txt file is also available in this Android SDK folder with the same rules but with optimizations enabled. ProGuard optimizations perform analysis at the bytecode level, inside and across methods to help make your app smaller and run faster. Android Studio adds the proguard-rules.pro file at the root of the module, so you can also easily add custom ProGuard rules specific to the current module.

请引用:https://developer.android.com/studio/build/shrink-code

意思是你应该将你自定义的proguard文件添加到proguard-rules.pro中,如果你想将一些规则分离到许多文件中,你可以这样做并在此之后声明它们:

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

关于android - proguard-android.txt 和 proguard-rules.pro 有什么区别? - 安卓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34554118/

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