From 353a506a0996a915003a0c3eb5974252826dc98f Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Sat, 2 Sep 2023 09:19:35 +0200 Subject: [PATCH] Fix Android release that generates a .aab file Creating Android release generates a .aab file. The Build() function was working with *.apk files only. So the AAB file was not copied and triggered a SELinux error. The copy sh command failed also. This commit fixes the problem by changing the pattern to match on copy, and the package name using ".aab" suffix. NOTE: it could be better to use filepath.Glob() to find files and use os.Rename() instead. --- internal/command/android.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/command/android.go b/internal/command/android.go index c1ec675..97745b1 100644 --- a/internal/command/android.go +++ b/internal/command/android.go @@ -80,6 +80,7 @@ func (cmd *android) Build(image containerImage) (string, error) { log.Info("[i] Packaging app...") packageName := fmt.Sprintf("%s.apk", cmd.defaultContext.Name) + pattern := "*.apk" err := prepareIcon(cmd.defaultContext, image) if err != nil { @@ -88,6 +89,8 @@ func (cmd *android) Build(image containerImage) (string, error) { if cmd.defaultContext.Release { err = fyneRelease(cmd.defaultContext, image) + packageName = fmt.Sprintf("%s.aab", cmd.defaultContext.Name) + pattern = "*.aab" } else { err = fynePackage(cmd.defaultContext, image) } @@ -101,8 +104,9 @@ func (cmd *android) Build(image containerImage) (string, error) { // https://github.com/fyne-io/fyne/blob/v1.4.0/cmd/fyne/internal/mobile/build_androidapp.go#L297 // To avoid to duplicate the fyne tool sanitize logic here, the location of // the dist package to move will be detected using a matching pattern - command := fmt.Sprintf("mv %q/*.apk %q", + command := fmt.Sprintf("mv %q/%s %q", volume.JoinPathContainer(cmd.defaultContext.WorkDirContainer(), cmd.defaultContext.Package), + pattern, volume.JoinPathContainer(cmd.defaultContext.TmpDirContainer(), image.ID(), packageName), )