正在获取警告 "NDK is missing a 'platforms" 目录。'没有NDK

Getting warning "NDK is missing a 'platforms" directory.' with no NDK

我有一个项目只使用 Android SDK,而不是 NDK,但是每当我使用 gradle 构建关于 NDK 的警告时:

NDK is missing a "platforms" directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /usr/local/opt/android-sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

似乎是一个非常明确的警告。我没有使用 ndk,所以我的 android-sdk 中没有 ndk-bundle。问题是我没有设置 ANDROID_NDK_HOME,而且我的 local.properties 文件(似乎是由 Android Studio 生成的)没有设置 NDK:

sdk.dir=/usr/local/opt/android-sdk

我有一个 ANDROID_HOME 环境变量:

ANDROID_HOME=/usr/local/opt/android-sdk

系统是 mac,但我们似乎在 Docker 中遇到了同样的问题。任何人都知道如何摆脱这个警告?

请参考这两个链接:

This is caused by upgrading to Android gradle plugin 2.3 (com.android.tools.build:gradle:2.3.0).

In previous versions of the plugin the databinding package name (where the BR file is generated) was provided on an annotation in a generate file. In the new version it's passed as a annotation processor option which is now handled.

An updated version will be available soon, a temporary workaround is to simply use the previous android gradle plugin 2.2.2