fyne-io/fyne · error

unsupported architecture:

Error message

unsupported architecture: 

What it means

The ndk variable is a map from GOARCH to toolchain config with exactly four keys: arm, arm64, 386, amd64. Toolchain(arch) is a plain lookup that panics on a miss. It is reached whenever the Android build target list contains an architecture not present in the map.

Source

Thrown at cmd/fyne/internal/mobile/env.go:401

		if util.Exists(toolPath) {
			return toolPath
		} else if runtime.GOOS == "windows" {
			// On windows some of the NDK executable have a .exe extension and some don't, so try both.
			toolPath += ".exe"
			if util.Exists(toolPath) {
				return toolPath
			}
		}
	}
	return ""
}

type ndkConfig map[string]ndkToolchain // map: GOOS->androidConfig.

func (nc ndkConfig) Toolchain(arch string) ndkToolchain {
	tc, ok := nc[arch]
	if !ok {
		panic(`unsupported architecture: ` + arch)
	}
	return tc
}

var ndk = ndkConfig{
	"arm": {
		arch:        "arm",
		abi:         "armeabi-v7a",
		minAPI:      16,
		toolPrefix:  "arm-linux-androideabi",
		clangPrefix: "armv7a-linux-androideabi",
	},
	"arm64": {
		arch:        "arm64",
		abi:         "arm64-v8a",
		minAPI:      21,
		toolPrefix:  "aarch64-linux-android",
		clangPrefix: "aarch64-linux-android",

View on GitHub (pinned to 8860ee95c3)

Solutions

  1. Restrict android targets to armeabi-v7a/arm/arm64, x86/386 and x86_64/amd64
  2. Remove the extra arch from -target and package the supported set
  3. Update fyne once the architecture is added to the ndk map

Example fix

# before
fyne package -os android -target android/arm64,android/riscv64

# after
fyne package -os android -target android/arm64,android/amd64
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: verify each android target against the toolchain map keys.
var androidABI = map[string]bool{"arm": true, "arm64": true, "386": true, "amd64": true}
func validateAndroidTargets(list []string) error {
    for _, t := range list {
        if !androidABI[t] { return fmt.Errorf("unsupported android target %q", t) }
    }
    return nil
}

Prevention

When it happens

Trigger: An Android build whose target list includes a GOARCH outside {arm, arm64, 386, amd64}, e.g. 'fyne package -os android -target android/riscv64'.

Common situations: Speculative targets for future Android ABIs before fyne/gomobile support them; scripts forwarding an arbitrary GOARCH into -target.

Related errors


AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15). Data as JSON: /api/errors/f2e14352405d40c6. Report an issue: GitHub.