No version of NDK matched the requested version

时间:2025-01-28 08:21:18

问题描述

No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669

问题原因

20年2月-6月发行的Android Gradle plugin 3.6-4.1之间的版本,如果项目有依赖ndk,可能存在编译不通过问题。4.1.0-beta01已修复该bug。

解决方案

  1. 修改Gradle版本为3.6以下或4.1-beta01以上的版本
  2. Install the older NDK it is looking for (side-by-side): sdkmanager ‘ndk;20.0.5594570’
  3. Manually specify the newer version in :
    android {
    compileSdkVersion 29
    ndkVersion “21.0.6113669”
    //…
    }
  4. Uninstall the NDK (if you don’t need it for other projects): sdkmanager --uninstall ‘ndk-bundle’ This is essentially the same as deleting the NDK folder(s) as others have suggested in this thread.

参考资料

  1. /gradle/gradle/issues/12440
  2. /issues/144111441
  3. /issues/152075797
  4. /actions/virtual-environments/issues/643