【问题标题】:Not able to set the path to files correctly in android.gradle无法在 android.gradle 中正确设置文件的路径
【发布时间】:2017-08-17 09:20:02
【问题描述】:
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 中导入任何库, 但是,当我评论这 2 行并取消注释以下 4 [那些特定的 **/lib1.so ,.. 等等,,] 时,这 4 个库被复制到 native-lib-folder 中。 我已经搜索过,我觉得正则表达式语法是正确的,但仍然无法理解我做错了什么。 请指导

【问题讨论】:

    标签: android regex gradle groovy filepath


    【解决方案1】:

    Ii 是 Ant path style 不是正则表达式。

    试试

    include '/folder1/*.so'
    include '/folder2/*.so'
    

    改为。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多