androidcommand-linegitlabgitlab-cindk-build

NDK build failed on Gitlab ci


my android project require NDK, in app/build.gradle

android {
        ...
        ndkVersion '23.1.7779620'
        ...
}

it work build on local. But throw failed on gitlab-ci like this :

> Task :app:configureNdkBuildDebug[arm64-v8a] FAILED
C/C++: /builds/company/repo/android-home/ndk/23.1.7779620/build/ndk-build: line 151: file: command not found
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:configureNdkBuildDebug[arm64-v8a]'.
> [CXX1405] error when building with ndkBuild using /builds/company/repo/app/src/main/jni/Android.mk: Build command failed.
  Error while executing process /builds/company/repo/android-home/ndk/23.1.7779620/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/builds/company/repo/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/builds/company/repo/app/src/main/jni/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/builds/company/repo/app/build/intermediates/cxx/Debug/6h35281x/obj NDK_LIBS_OUT=/builds/company/repo/app/build/intermediates/cxx/Debug/6h35281x/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
  ERROR: Cannot find 'make' program. Please install Cygwin make package
  or define the GNUMAKE variable to point to it.
  
  /builds/company/repo/android-home/ndk/23.1.7779620/build/ndk-build: line 151: file: command not found

this the .gitlab-ci.yml script:

<script src="https://gitlab.com/-/snippets/2405255.js"></script>

How to resolve this? thanks in advance.


Solution

  • Make is not present in the openjdk docker images. You can install it by extending this line:

     - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
    

    to

     - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 make