Search code examples
androidazure-devopsandroid-ndkazure-pipelinesazure-devops-hosted-agent

Flutter Android build error in Azure Pipeline: No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi


I'm getting error No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi. The solutions I found were to upgrade or downgrade NDK in Android Studio. However, I'm using Azure Pipeline and am not sure how to do that.

There were two runs, where one of them was successful, and the other one was failed. Both of them had a same commits and only differs by one day. The only difference between them was the agent and image version in Initialize Job task.

Success:

Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az394-23'
Current agent version: '2.192.0'
Operating System
Virtual Environment
Virtual Environment Provisioner
Current image version: '20210919.1'
Agent running as: 'vsts'
Prepare build directory.

Failed:

Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az216-247'
Current agent version: '2.193.0'
Operating System
Virtual Environment
Virtual Environment Provisioner
Current image version: '20210929.1'
Agent running as: 'vsts'
Prepare build directory.

I think the solution is either configuring the gradle (which I'm not sure which one to fix) or reconfigure NDK in MS hosted agent (which I'm not sure how).

Any advice? I'm not sure whether this is flutter (1.22.6) specific or android problem in general. However, I can build it just fine on my machine.


Solution

  • As discussed in this github issue workaround, basically we need to add NDK version in app/build.gradle. The minimal solution would be:

    android {
        compileSdkVersion 30
        ndkVersion "21.4.7075529"
        ...
    }