gpt4 book ai didi

android - 在 Android Studio 中的所有模块的顶层构建文件中设置 proguard

转载 作者:行者123 更新时间:2023-12-03 03:35:02 27 4
gpt4 key购买 nike

我的项目目前包含三个模块,它们都应该在构建时被混淆。

现在我不想为每个模块定义一个 proguard 配置,而是为所有模块定义一个配置。

有 build.gradle 顶层构建脚本,对所有模块都有效

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

}

allprojects {
repositories {
jcenter()
}
}

如何在此文件中配置 proguard,以便为我的所有模块执行?

最佳答案

您可以将 proguard 文件存储在项目扩展属性中,然后从每个模块访问它:

项目 build.gradle:

allprojects {

project.ext {
proguardFile = "myproguardfile.txt"
}

repositories {
}
}

模块:
buildTypes {
release {
runProguard false
proguardFiles project.ext.proguardFile
}
}

关于android - 在 Android Studio 中的所有模块的顶层构建文件中设置 proguard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25339371/

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