gpt4 book ai didi

android - Gradle如何从apk中排除文件

转载 作者:太空宇宙 更新时间:2023-11-03 13:52:58 26 4
gpt4 key购买 nike

我将我的 keystore 存储在我的 Assets 目录中。如何在构建中排除它以创建 .apk?

我试过那样但仍然存在:

android {
...
packagingOptions {
...
exclude 'META-INF/LICENSE.txt'
...
exclude 'assets/keystore'
}
}

它排除了 LICENSE.txt 但不包括 keystore

最佳答案

尝试下一个:

    ...
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}

android.applicationVariants.all { variant ->
//if (variant.name.contains('Release')) { // exclude source and sourcemap from release builds
def rmkeystore = task("delete${variant.name}.rmkeystore", type: Delete) {
delete "${buildDir}/intermediates/assets/${variant.dirName}/keystore"
}
variant.mergeAssets.finalizedBy rmkeystore
//}
}

引用:https://stackoverflow.com/a/29168827/717267

关于android - Gradle如何从apk中排除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32885763/

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