android - gradle experimental ndk 仅构建目录的子集

标签 android c++ android-studio android-ndk gradle-experimental

我正在将 gradle2.9 与 gradle-experimental-0.6.0-alpha3 插件一起用于 android studio,但我遇到了一个我似乎无法解决的问题。

这是我的目录结构:

  • 顶级目录
    • 文件A.cpp
    • 目录
      • 文件A1.cpp
      • 文件A2.cpp

我想编译fileA.cpp, fileA1.cpp 但不编译fileA2.cpp

1°) 我尝试使用选择性目录包括:

android.sources {
    main {
        jni {
            source {
               srcDirs = ["dirA","dirA1/fileA1.cpp"]
            }
        }
    }
}

但是我得到了 dirA1/fileA1.cpp 不是目录的错误,而且我找不到包含文件的方法。

2°) 我尝试使用选择性目录排除:

android.sources {
    main {
        jni {
            source {
               srcDirs = ["TopDir"]
               exclude "fileA2.cpp"
            }
        }
    }
}

但这也不起作用,因为 exclude 等待一个目录。即使使用通配符(如“exclude *A2*”)似乎也不起作用。

有谁知道使用新的 gradle 实验工具来做到这一点(即使它需要一个一个地包含文件)?

最佳答案

对于exclude,可以使用通配符,例如

exclude "**/*A2.cpp"

关于android - gradle experimental ndk 仅构建目录的子集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34317537/

相关文章:

Android - 更改 android 操作栏的位置

Android 小部件不显示它的属性我要写时的建议

java - Web 服务不工作 (Android Studio)

android - 将 40px 转换为 sp

android - Android 应用程序中的 SQL 数据库多久更新一次

c++ - 有没有办法至少为 catch(...) 获取一些信息?

C++读取带空格的字符串

c++ - SetWindowLongPtr 与 DialogBoxParam?

android - 任务 mockableAndroidJar 执行失败

android - PluginApplicationException : Failed to apply plugin class 'FlutterPlugin'