golang/go

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

已关闭

#79,606 创建于 2026年5月22日

 (5 条评论) (0 个反应) (0 位负责人)Go (19,008 个派生)batch import
FixPendingNeedsFixhelp wantedmobile

仓库指标

星标
 (133,883 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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 ❤️

贡献者指南