Android build failed in CI because of NDK version is not compatible, but not locally


Probably this is not the first time you see a question like this. I’ven looking into some explanations and realized that this is related to the Gradle Plugin not downloading the default version of SDK, and since in CI you usually have a machine set up that might not have exactly the same default version installed, then it would fail.


My question is to finally understand what is actually goin on, I am curious about WHY IT FAILS ON CI ONLY AND NOT LOCALLY IF I DO NOT EVEN HAVE ANY NDK VERSIONS INSTALLED LOCALLY

So, I ran the same command than in CI (./gradlew assembleDebug), and I end up with only a warning like this (Build was successful):

> Task :app:stripDebugDebugSymbols UP-TO-DATE
WARNING: Compatible side by side NDK version was not found for android.ndkVersion '21.3.6528147'
Compatible side by side NDK version was not found for android.ndkVersion '21.3.6528147'

However, the same command in CI end up with this result:

2020-06-25T01:45:32.2616030Z > Task :app:mergeDebugNativeLibs
2020-06-25T01:45:32.3617430Z > Task :app:stripDebugDebugSymbols FAILED
2020-06-25T01:45:32.7615773Z > Task :app:mergeExtDexDebug
2020-06-25T01:45:32.7657658Z FAILURE: Build failed with an exception.
2020-06-25T01:45:32.7658405Z * What went wrong:
2020-06-25T01:45:32.7659460Z Execution failed for task ':app:stripDebugDebugSymbols'.
2020-06-25T01:45:32.7659848Z > No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.3.6528147
2020-06-25T01:45:32.7660439Z * Try:
2020-06-25T01:45:32.7661003Z Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2020-06-25T01:45:32.7661602Z * Exception is:
2020-06-25T01:45:32.8621953Z org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:stripDebugDebugSymbols'.
2020-06-25T01:45:32.8622201Z 148 actionable tasks: 148 executed

So, I would like to understand what would be the difference, or what would cause CI to have a different behavior than my local setup.

My local setup:

  1. OSX Catalina 10.15.4
  2. No SDK installed
  3. Android Studio 4.0

CI Configuration:

  1. GitHub Actions Android (ubuntu-18.04)

Project configuration:

  1. Gradle Android plugin: 4.0.0
  2. Gradle version (using wrapper to make sure both commands were executed with same version): 6.1.1
  3. Build tools: 29.0.3

Any advice is welcome, thanks in advance!


This is

The logic for selecting NDKs changed to make builds more reproducible. Changes were made to relax that when the NDK is only used for stripping dependencies, but it incorrectly only relaxes the restriction when no NDK is installed.

As to how to fix your problem, just set android.ndkVersion to whatever you have available on CI in your build.gradle.

Answered By – Dan Albert

Leave a Comment