'Trying to build Android app but got clang error
I'm new to Android development. So want to start and just build and run Hello World app in my mobile. I've installed NDK, clang-12, Fyne and run
fyne package --os android --appID com.example.myapp
Got
go build -buildmode=c-shared -o /tmp/gomobile-work-791801243/lib/armeabi-v7a/libparts.so parts failed: exit status 2
# runtime/cgo
clang: error: no input files
The project's structure:
parts:
- go.mod
- Icon.png
- main.go
If I run manually from project root (parts)
go build -buildmode=c-shared -o /tmp/gomobile-work-791801243/lib/armeabi-v7a/libparts.so parts
It creates .so file without any error. Seems like it's just about relative path, but how can I fix it? Sorry for providing poor info, really don't know what may be useful. So please write in comments what info do you need and I'll provide it.
Solution 1:[1]
Are you running the command from inside the “parts” folder? Perhaps you have GOOS or GOARCH set which could alter the build path?
Solution 2:[2]
You might have a broken development environment when trying to build for Android. Short of reinstalling it, I would recommend using fyne-cross with either docker or podman.
Just install fyne-cross with:
go install github.com/fyne-io/fyne-cross@latest
Followed in your application directory by:
fyne-cross android
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 | andy.xyz |
| Solution 2 | Cedric Bail |
