From 2ef2c9323b253e7c5f10a1ed0975a49c6f3adf6a Mon Sep 17 00:00:00 2001 From: Igor Karatayev Date: Thu, 29 Feb 2024 00:04:20 +0300 Subject: [PATCH 1/2] mobile: Fix -androidapi parameter not working when using gomobile build command MinSDK was not properly propagated to binres where AndorinManifest.xml is composed and use-sdk tag is added Change-Id: I3bd34341aee53e02b39edc57967b2338d9beb2b0 --- cmd/gomobile/build_androidapp.go | 1 + internal/binres/sdk.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/gomobile/build_androidapp.go b/cmd/gomobile/build_androidapp.go index bcd2664bd..e9bbe207c 100644 --- a/cmd/gomobile/build_androidapp.go +++ b/cmd/gomobile/build_androidapp.go @@ -25,6 +25,7 @@ import ( ) func goAndroidBuild(pkg *packages.Package, targets []targetInfo) (map[string]bool, error) { + binres.MinSDK = buildAndroidAPI ndkRoot, err := ndkRoot(targets...) if err != nil { return nil, err diff --git a/internal/binres/sdk.go b/internal/binres/sdk.go index 607e0b7dc..4e91ee9e4 100644 --- a/internal/binres/sdk.go +++ b/internal/binres/sdk.go @@ -13,7 +13,9 @@ import ( ) // MinSDK is the targeted sdk version for support by package binres. -const MinSDK = 16 +var ( + MinSDK = 16 +) func apiResources() ([]byte, error) { apiResPath, err := apiResourcesPath() From a0bd17f605593f3913dd2f6941476b44fc83f28d Mon Sep 17 00:00:00 2001 From: Igor Karatayev Date: Wed, 3 Apr 2024 12:25:16 +0300 Subject: [PATCH 2/2] Update platformBuildVersionCode. Change-Id: I711926ac5b9a1b4212ef8e5d6afe18962dbe1c1a --- internal/binres/binres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/binres/binres.go b/internal/binres/binres.go index d77bde265..cb5aab175 100644 --- a/internal/binres/binres.go +++ b/internal/binres/binres.go @@ -250,7 +250,7 @@ func UnmarshalXML(r io.Reader, withIcon bool) (*XML, error) { Space: "", Local: "platformBuildVersionCode", }, - Value: "16", + Value: fmt.Sprintf("%v", MinSDK), }, xml.Attr{ Name: xml.Name{