fyne-io / fyne-cross

Cross compiler tool for Fyne apps
BSD 3-Clause "New" or "Revised" License
247 stars 50 forks source link

Add asset folder to an android fyne app with fyne-cross #168

Closed kendrickjung closed 1 year ago

kendrickjung commented 1 year ago

Is your feature request related to a problem? Please describe:

I am trying to build a repo that can be found here: https://github.com/wetorrent/wetorrent

As I am packaging this project using fyne-cross for android as follow: sudo ./fyne-cross android -arch=* -app-id=test.myapptest.com

In the packaged android app I only get the binaries. I tried to add the Webapp folder in an asset folder but it does not add this folder in the final package.

Is it possible to construct a solution with the existing API?

I do not know .

Describe the solution you'd like to see:

an option like -assetfolder that indicates to the fyne-cross cross compiler the folder to add to the finale packaged android app.

Jacalz commented 1 year ago

We don’t recommend relying on files outside of the binaries when distributing binaries. This gets wrong fast and causes issues when you move the binaries.

If you need to bundle a folder, I would suggest using the embed package (available in Go 1.16 and later). You can get a good introduction over at https://blog.jetbrains.com/go/2021/06/09/how-to-use-go-embed-in-go-1-16/. This is especially good if you need to share whole folders for web servers and such.

You can also use the fyne bundle command to bundle the files as well. This works for Go versions below Go 1.16 and is good if you primarily have images. It is not as automatic but gives you Fyne resources directly. More information is available here: https://developer.fyne.io/extend/bundle.