golang/go

x/mobile: Logic To Get Highest Android SDK Installed Breaks With New SDK Versioning System, Preventing Building AARs

Closed

#79,606 opened on May 22, 2026

 (5 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
FixPendingNeedsFixhelp wantedmobile

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

go mobile bind can not find android SDKs higher than APi 36. The latest released Android SDK right now is SDK 36.1. Now that Android SDK is doing minor releases, this function won't work with the forthcoming API 37 (android-37.0) and any future SDKs after that.

the logic to comb through the SDK dir relies on strconv.Atoi which errors out here. Seems like adapting this logic to Strconv.ParseFloat is in order.

O my machine, I assume it is resolving android-36 since that's all this function can comprehend. I haven't tested it, but this must be breaking things for users with fresh installs of the Android SDK that only have the android-36.1 SDK directory on their machine.

in internal/sdkpath/sdkpath.go:

func AndroidAPIPath(api int) (string, error)  {
  // ...
var apiPath string
	var apiVer int
	for _, fi := range fis {
		name := fi.Name()
		if !strings.HasPrefix(name, "android-") {
			continue
		}
		n, err := strconv.Atoi(name[len("android-"):])
		if err != nil || n < api {
			continue
		}
		p := filepath.Join(sdkDir.Name(), name)
		_, err = os.Stat(filepath.Join(p, "android.jar"))
		if err == nil && apiVer < n {
			apiPath = p
			apiVer = n
		}
	}
  // ...

Thanks ❤️

Contributor guide