# Building Go/Golang Android app using Gradle and Cmake

**URL:** https://discourse.cmake.org/t/building-go-golang-android-app-using-gradle-and-cmake/14306
**Category:** Usage
**Tags:** os:linux, gen:ninja
**Created:** [July 2, 2025, 9:50am UTC](https://discourse.cmake.org/t/building-go-golang-android-app-using-gradle-and-cmake/14306 "2025-07-02T09:50:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ziik](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ziik/32/5645_2.png) [@ziik](https://discourse.cmake.org/u/ziik)
#### Post date: [July 2, 2025, 9:50am UTC](https://discourse.cmake.org/t/building-go-golang-android-app-using-gradle-and-cmake/14306/1 "2025-07-02T09:50:07Z")

</div>

Hi, I am trying to build the Golang Android native application using Gradle and CMake. And I would like to ask for help with the CMake configuration.  
I uploaded the project I’m testing on to GitHub [GitHub - tomas-mraz/studio-gradle-cmake-go: Building native Golang Android application from Android Studio](https://github.com/tomas-mraz/studio-gradle-cmake-go)

compile is like: Gradle → Gradle plugin com.android.build.api.dsl.NdkBuild → cmake with File API → go build

Result should be `.so` shared library and `.apk` application package with the library inside.

It looks like File API json file for custom build target “build-go-lib” is pointing to files that do not exist (was not generated).  
It results in Gradle failure:

```log
C/C++: /home/tomas/aplikace2/app/src/main/cpp/CMakeLists.txt debug|arm64-v8a : There was an error parsing CMake File API result. Please open a bug with zip of /home/tomas/aplikace2/app/.cxx/Debug/3v82m1s2/arm64-v8a

```

Please very much to check my CMakeFiles.txt for mistakes (me and AI have exhausted our options)

> <https://github.com/tomas-mraz/studio-gradle-cmake-go/blob/main/aplikace2/app/src/main/cpp/CMakeLists.txt>

In the file `/home/tomas/aplikace2/app/.cxx/Debug/4zb12x4p/arm64-v8a/.cmake/api/v1/reply/target-build-go-lib-Debug-ee877b4d829a5e2f94b2.json`  
is content…

```json
"sources" : 
	[
		{
			"backtrace" : 1,
			"isGenerated" : true,
			"path" : "/home/tomas/aplikace2/app/.cxx/Debug/4zb12x4p/arm64-v8a/CMakeFiles/build-go-lib",
			"sourceGroupIndex" : 0
		},

```

But `/home/tomas/aplikace2/app/.cxx/Debug/4zb12x4p/arm64-v8a/CMakeFiles/build-go-lib` does not exist … why?

CMake itself and Ninja works … it makes .so shared library. But Gradle build failed on CMake integration.

---

<div class="post-metadata">

### Author: ![ziik](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ziik/32/5645_2.png) [@ziik](https://discourse.cmake.org/u/ziik)
#### Post date: [July 8, 2025, 9:03pm UTC](https://discourse.cmake.org/t/building-go-golang-android-app-using-gradle-and-cmake/14306/2 "2025-07-08T21:03:47Z")

</div>

I rework it differently and do not use CMake. Thank all the people who read my post.
