Skip to content

Commit

Permalink
Fix Android release that generates a .aab file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
metal3d committed Sep 2, 2023
1 parent aac9d4e commit 353a506
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/command/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand All @@ -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),
)

Expand Down

0 comments on commit 353a506

Please sign in to comment.