---
title: "NDK Error When Compiling a Shared Library (.so): executing external native build for cmake"
description: "I was in the middle of adding a C++ shared library to Flutter and figured I'd try writing a native Java version first, and then I ran into this cursed problem😱..."
author: "kidneyweakx"
published: 2020-04-11T04:42:35.000Z
updated: 2025-12-17T23:03:57.644Z
lang: en
tags: ["程式筆記", "Javascript"]
canonical: https://kidneyweakx.com/blog/20log-0411-ndkexc?lang=en
alternate_zh_tw: https://kidneyweakx.com/blog/20log-0411-ndkexc.md
alternate_ja: https://kidneyweakx.com/blog/20log-0411-ndkexc.md?lang=ja
---

# NDK Error When Compiling a Shared Library (.so): executing external native build for cmake

I was in the middle of adding a C++ shared library to Flutter and figured I'd try writing a native Java version first, and then I ran into this cursed problem😱😱😱.
```Java
bug: Error > "executing external native build for cmake"
```
At first I assumed it was some syntax issue in CMakeLists.txt, but after carefully rewriting it, the problem was still there.

[I followed this post](https://blog.csdn.net/kidults/article/details/80599923) hoping it might help, but it still died halfway through with the same error.
HMMMM🤔...... In between I tweaked build.gradle and cmake every which way, and no matter what I tried, it just wouldn't compile.

Scrolling through the comments, I found this [fix](https://blog.csdn.net/qq_36818970/article/details/88797526).
Downgrading my gradle version to 3.2.1 actually got it to compile
![](https://raw.githubusercontent.com/kidneyweakx/img-host/image/image/20200411-ndkerror.png)

My guess is the SDK tools were missing some dependencies~ But I have zero intention of getting to the bottom of it. Back to grinding away as a code laborer. Fixing this was only where the nightmare began.
