task copyLibs(type: Copy) {
mybuildpath('path.name').string.split(" ")
.collect {
mybuildpath('[' + it + ']pkg.lib').string
}
.findAll {
it.length() > 0
}
.each {
from(new File(it)) {
if (!getCurrentFlavor().contains('SomeKeyWord')) {
include '**/folder1/**/*.so'
include '**/folder2/**/*.so'
// include '**/lib1.so'
// include '**/lib2.so'
// include '**/lib3.so'
// include '**/lib4.so'
} else {
include '**/*.so'
}
}
into new File(buildDir, 'native-libs-folder')
}
}
在我的项目的android.gradle中,我在编译时必须包含几个.so文件。
folder1和folder2具有所有这些库[lib1,lib2,...等],我想将它们全部包括在内。
但是此代码无法正常工作,并且无法在我的native-lib-folder中导入任何库,
但是,当我注释这两行并取消注释下面的4 [那些特定的** / lib1.so,..等等,,]时,这4个库将被复制到native-lib-folder中。
经过搜索,我觉得正则表达式语法正确,但是仍然无法理解我在做什么。
请指导
最佳答案
关于android - 无法在android.gradle中正确设置文件的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45731181/