'Azure devops pipline No toolchains found in the NDK toolchains folder for ABI with prefix

Hi I'm trying to build react native android app in azure pipelines but I can't get it to work... The error I'm keep getting is like this. I tried everything I found on google but nothing helped.

Build task:

    - task: Gradle@2
  displayName: "Build APK"
  inputs:
      gradleWrapperFile: "android/gradlew"
      workingDirectory: "android/"
      options: "-PversionName=$(NEW_VERSION) -PversionCode=$(Build.BuildId)"
      tasks: "assembleStage" # assembleRelease or assembleStage
      publishJUnitResults: false
      javaHomeOption: "JDKVersion"
      jdkVersionOption: "1.11"
      gradleOptions: "-Xmx3072m"
      sonarQubeRunAnalysis: false

I use com.android.tools.build:gradle:3.5.2 (and can't upgrade it)

ERROR:

Task :react-native-document-scanner:stripReleaseDebugSymbols FAILED

Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.

Task :app:mergeStageJavaResource Task :app:mergeExtDexStage

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':@react-native-document-scanner:stripReleaseDebugSymbols'.

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 25m 59s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings 690 actionable tasks: 690 executed Error: The process '/Users/runner/work/1/s/android/gradlew' failed with exit code 1 at ExecState._setResult (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.200.2/node_modules/azure-pipelines-task-lib/toolrunner.js:944:25) at ExecState.CheckComplete (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.200.2/node_modules/azure-pipelines-task-lib/toolrunner.js:927:18) at ChildProcess. (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.200.2/node_modules/azure-pipelines-task-lib/toolrunner.js:840:19) at ChildProcess.emit (events.js:198:13) at maybeClose (internal/child_process.js:982:16) at Socket.stream.socket.on (internal/child_process.js:389:11) at Socket.emit (events.js:198:13) at Pipe._handle.close (net.js:607:12)

I tried specify ndkVersion to "21.4.7075529" didn't help. Also I tried to upgrade gradle version to 4.1.0 but same error came up.

Thanks



Solution 1:[1]

I managed to fix it by adding bash script as step like this:

echo "ndk.dir=$ANDROID_NDK_HOME" >> local.properties

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Wójcikiewicz