android - Android 中使用 build.gradle 进行混淆、缩小

标签 android

代码中的含义是什么?

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

据我所知: minifyEnabled 设置为 true 允许启用 R8 的代码收缩。 但我没有看到 useProguard 设置为 true,默认情况下是 true 吗? 它适用于我的情况吗?

useProguard = true

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

最佳答案

您好,在新的 Android 版本中,不再需要使用“useProguard true”。

当您使用 Android Gradle 插件 3.4.0 或更高版本构建项目时,该插件不再使用 ProGuard 来缩减您的代码。相反,该插件默认与 R8 编译器配合使用,以处理缩小、混淆和优化应用程序的责任。

但是您仍然需要 proguard 文件来提及您的规则。

https://www.youtube.com/watch?v=bgpyuuzMlo0

我认为这是有关该主题的最佳视频之一,如果可以的话请观看。

关于android - Android 中使用 build.gradle 进行混淆、缩小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68095919/

相关文章:

android - 在Android中,当我播放音频并进行其他 Activity 时,音频在返回后不会停止

android - 创建虚拟显示后调用release()不起作用

android - Backendless multiuser flow - 切换当前用户

android - Android上INSTALL_FAILED_INSUFFICIENT_STORAGE错误的解决方案

android - 如何在android中相对于另一个对象扩展图像

android - 禁用在 Android Lollipop 中隐藏通知的可能性

java - fragment View 中 webview 的进度条

android - 使用 Android 返回 405 的 Get 方法请求 MVC4 WEB API

android - 在 View 检查器中更新边距值对布局没有影响

适用于电子表格的 Android Google Api