Skip to content

Android build generates bindings with mixed host and Android build contexts #5810

Description

@ashcastle

Description

The stock Android build forwards -tags android,debug to the common frontend binding task, but the binding generator still runs with the host GOOS. On macOS this makes the Go loader select both Darwin and Android implementations, producing 98 analyzer warnings before an otherwise successful Android build.

The Android Taskfile already defines generate:android:bindings with GOOS=android and CGO_ENABLED=0, but android:build reaches common:generate:bindings through common:build:frontend instead, so the Android-specific task is not used.

Reproduction

From the stock v3/examples/mobile project on macOS arm64:

GOWORK=off wails3 generate bindings -dry -f "-tags android,debug"

The command completes with 98 warnings emitted, including pairs such as:

assetserver_darwin.go: baseURL redeclared in this block
assetserver_android.go: other declaration of baseURL
application_darwin.go: newPlatformApp redeclared in this block
application_android.go: other declaration of newPlatformApp
runtime/cgo: fatal error: android/log.h file not found

Running the same analysis with the Android target removes the host/target collisions:

GOWORK=off GOOS=android CGO_ENABLED=0 \
  wails3 generate bindings -dry -f "-tags android,debug"

This reduces the result to four warnings, all caused by two missing helpers in application_android_nocgo.go:

undefined: androidBridgeVoid
undefined: androidBridgeStringString

Expected behaviour

Android binding generation should:

  • load only Android-compatible source files;
  • work without an installed NDK by using the non-cgo Android stubs;
  • emit no platform collision or missing-stub warnings;
  • leave desktop binding generation unchanged.

Environment

  • Wails: v3.0.0-alpha2.117
  • Go: go1.26.5
  • Host: macOS arm64
  • Reproduced with the checked-in v3/examples/mobile project.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingP2Medium priorityandroidAndroid platformmobileMobile platform workv3

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions