`transformNativeLibsWithStripDebugSymbol` 没有执行

`transformNativeLibsWithStripDebugSymbol` is not executing

我有一个例程期望 AGP 在 assembleDebug 上生成 app/build/intermediates/transforms/stripDebugSymbol/debug 目录。我的依赖项中还有一些带有本机代码的 aars。它在我的本地机器上运行良好,但在我的 CI 上不起作用。我发现这个文件夹是由任务transformNativeLibsWithStripDebugSymbolForDebug产生的。但是在我的 CI 上它甚至没有这样的任务。

Task with path 'transformNativeLibsWithStripDebugSymbolForDebug' not found in project ':app'

不幸的是我不知道哪里出了问题。至少不是没有 AGP 源代码。

所以问题是:什么触发 transformNativeLibsWithStripDebugSymbolassemble 期间执行,或者我如何强制执行它?

我正在使用 AGP 3.1.3 和 gradle 包装器 4.5。

最终我发现AGP只有在配置了NDK时才会抛出NDK相关的任务(duh),即ndk.dir设置在local.propertiesANDROID_NDK_HOME/ANDROID_NDK(我不确定哪个是强制性的)设置了环境变量。

UPD:根据 AGP 源代码,它是 ANDROID_NDK_HOME,至少目前是这样。 https://android.googlesource.com/platform/tools/build/+/refs/heads/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy#205