问题描述
我想在 gradle.properties 文件中添加 ndk.abiFilters 属性.现在我在 build.gradle 中有这个属性.这是我的 build.gradle 的一部分
I want to add ndk.abiFilters property in gradle.properties file. Now I've this property inside build.gradle.Here is part of my build.gradle
buildTypes {
debug {
ndk {
abiFilters "x86", "armeabi-v7a", "armeabi"
//abiFilters ABI_FILTERS
}
}
}
这是我的 gradle.properties 文件的一部分
Here's part of my gradle.properties file
ABI_FILTERS = "x86", "armeabi-v7a", "armeabi"
问题是 gradle.properties 中的字符串未正确转换为与 abiFilters 一起使用.我尝试了许多变体,但没有运气.如何正确执行此操作的正确方法是什么?谢谢你的帮助.
Problem is that String from gradle.properties is not correctly converted for use with abiFilters. I tried many variants but with no luck. What is the correct way how to do this correctly? Thank you for help.
推荐答案
在 gradle.properties 中你可以有例如:
In gradle.properties you can have for example:
ABI_FILTERS=armeabi-v7a;x86 //delimiter can be anything (change below)
然后在 build.gradle 中有(例如在调试 buildType 部分):
Then in build.gradle there is (for example in debug buildType section):
ndk {
abiFilters = []
abiFilters.addAll(ABI_FILTERS.split(';').collect{it as String})
}
现在每个开发人员都可以为他当前的测试设备独立选择 abi(gradle.properties 在 .gitignore 中).
Now each developer can choose independetly abi for his current testing device (gradle.properties is in .gitignore).
感谢 Igor Ganapolsky 的开始提示.
Thanks Igor Ganapolsky for starting hint.
这篇关于将 abiFilters 添加到 gradle 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!