KRTirtho / spotube

🎧 Open source Spotify client that doesn't require Premium nor uses Electron! Available for both desktop & mobile!
https://spotube.krtirtho.dev/
Other
30.71k stars 1.27k forks source link

[Bug] Android - F-Droid can't build #430

Closed licaon-kter closed 1 year ago

licaon-kter commented 1 year ago

Saw version 17 fail: https://gitlab.com/fdroid/fdroiddata/-/jobs/3891617399

So I tried to bump Flutter to 3.7.6, but that brought up librust.so binary deps to the surface: https://gitlab.com/fdroid/fdroiddata/-/commit/493af32591b1b93607b30f9557a2e0c6b3a755b5#note_1305278538

OK, so I built that too: https://gitlab.com/fdroid/fdroiddata/-/commit/1e3e91193e2a6c7003a351fe1499a84bd6a37d0f

But still fails later in Flutter: oss.krtirtho.spotube_17.log.gz

KRTirtho commented 1 year ago

librust.so is a required dependency. It parses and writes metadata for mp3/m4a/ogg/floc etc audio formats Removing it from the build will definitely cause error

KRTirtho commented 1 year ago

Also not sure about rebuilding librust in the pipeline. Is it a good idea?

licaon-kter commented 1 year ago

As said, we rebuild it... Also the error above is at build time, not while running the app... we did not reach that step yet. :)

What's next? Which Flutter version did you use?

KRTirtho commented 1 year ago

Also the error above is at build time, not while running the app... we did not reach that step yet. :)

yeah right

What's next? Which Flutter version did you use?

v3.7.3

KRTirtho commented 1 year ago

Btw, this workflow might help you https://github.com/KRTirtho/metadata_god/blob/v0.3.2/.github/workflows/build-libs.yaml

KRTirtho commented 1 year ago

Also, the pipeline using Java 8 right?

KRTirtho commented 1 year ago

Oh... Ok. In 2.7.0 I added a .env file which is required

KRTirtho commented 1 year ago

@licaon-kter is there any way to provide the content of the .env file without exposing them?

Because, exposing those secrets can exploit user security plus can give bad actors access to the backend (https://spotube.pockethost.io/)

Root of the issue output:

[        ] Successfully started process 'command '/home/vagrant/build/srclib/flutter/bin/flutter''
[+86100 ms] Error detected in pubspec.yaml:
[        ] No file or variants found for asset: .env.            <--- this is causing the build error
[+34297 ms] Target aot_android_asset_bundle failed: Exception: Failed to bundle asset files.
[+4799 ms] > Task :app:compileFlutterBuildRelease FAILED
[  +99 ms] Android Lint: Disposing Uast application environment in lint classloader [30.2.1]
[ +100 ms] FAILURE: Build failed with an exception.
[        ] * Where:
[        ] Script '/home/vagrant/build/srclib/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1151
licaon-kter commented 1 year ago

is there any way to provide the content of the .env file without exposing them?

No... we have no secrets... your recipe already provides some: https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/oss.krtirtho.spotube.yml#L212-L213 are those not enough?

Btw, this workflow might help you https://github.com/KRTirtho/metadata_god/blob/v0.3.2/.github/workflows/build-libs.yaml the pipeline using Java 8 right?

Yeah, saw it, but I kinda ignored Java 8 :) Since last year we switched to Debian Bullseye so it's Java11 by default. But I can have it use Java8 if needed.

Well... once you clarify what .env should contain.

KRTirtho commented 1 year ago

Luckily, the app can run without the backend. So the basic info will get the job done. Let's do this workaround for this release, in the next one I'll use a better way of connecting to backend

So create the .env in project root before flutter build

$ echo "POCKETBASE_URL=https://spotube.pockethost.io/" >> .env
licaon-kter commented 1 year ago

Taking it for a spin now

licaon-kter commented 1 year ago

Can you test the APK? (remove .zip and unpack .001 with 7zip) st.7z.001.zip st.7z.002.zip st.7z.003.zip st.7z.004.zip

Another thing, it does not make sense to check for updates for the F-Droid build, so, is it enough to set this to false at build time? https://github.com/KRTirtho/spotube/blob/v2.7.0/lib/provider/user_preferences_provider.dart#L51

KRTirtho commented 1 year ago

Yeah, an Env variable to toggle this on and off must be added

KRTirtho commented 1 year ago

Cannot open archive. 7z not working

$  7zz e st.7z.001
7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15
 64-bit locale=en_US.UTF-8 Threads:4, ASM

Scanning the drive for archives:
1 file, 9437184 bytes (9216 KiB)

Extracting archive: st.7z.001
ERROR: st.7z.001
st.7z
Open ERROR: Cannot open the file as [7z] archive

ERRORS:
Unexpected end of archive

Can't open as archive: 1
Files: 0
Size:       0
licaon-kter commented 1 year ago

The archive files work fine for me, delete them and redownload :shrug:

KRTirtho commented 1 year ago

Can you provide me this with a zip format. I don't know why these are not working. Other 7z files working fine

licaon-kter commented 1 year ago

ZIP can't do multivolumes and the upload size is limited here :shrug:

Did you save and renamed all 4 files before trying to unpack?

/LE:

is it enough to set this to false at build time? https://github.com/KRTirtho/spotube/blob/v2.7.0/lib/provider/user_preferences_provider.dart#L51

And the answer is ... no... as that makes it ... fail to build :scream:

KRTirtho commented 1 year ago

And the answer is ... no... as that makes it ... fail to build scream

No it should build, this means by default the update checker will be toggled off

KRTirtho commented 1 year ago

Oh it was fragmented 7zip. I thought those are separate arch apk (aarch64, arm32, x86, x64) :sweat_smile: Was able to extract it

KRTirtho commented 1 year ago

And I can confirm everything is still working as expected in the app

licaon-kter commented 1 year ago

I've retried now and it build fine :facepalm: nvm me then

Anyway, that line works fine, check update is disabled and the app does not start to connect to Github right away.

So, can we update the recipe to include this?

KRTirtho commented 1 year ago

Yup

licaon-kter commented 1 year ago

Done, thanks https://gitlab.com/fdroid/fdroiddata/-/commit/b0fec80aa3bd4e0e38d1b5e742d3a7b05f4d194a

KRTirtho commented 1 year ago

No, thank you. You're helping so much in the open source community. Keep up your great service :+1:

licaon-kter commented 1 year ago

Regarding flutter, any chance you could add it as a submodule in your repo?

It will erase the need to manually open MRs when updating Flutter version, as you control the version directly here

ref: https://git-scm.com/book/en/v2/Git-Tools-Submodules

and ref: https://gitlab.com/fdroid/fdroiddata/-/blob/master/templates/build-flutter.yml

KRTirtho commented 1 year ago

Just using .gitmodules?

KRTirtho commented 1 year ago

But I already have a fvm configuration in the .fvm which is a natural way of handling flutter versions Can f-droid use fvm automatically when it detects the .fvm/flutterSdkVersion file?

licaon-kter commented 1 year ago

This is news to me, is this a new thing or? I don't recall Flutter devs using this so far... we're mostly guessing the version and "hope latest works" :)

KRTirtho commented 1 year ago

fvm has been around for a while now😄

licaon-kter commented 1 year ago

I guess that most projects that are in F-Droid might not use it then

KRTirtho commented 1 year ago

You can always make it a requirement for flutter apps. It's better to keep track of Flutter versions for your app then failing on CI

KRTirtho commented 1 year ago

@licaon-kter Spotube 2.7.0 is still not available in the fdroid repo. Was there any problem building it?

licaon-kter commented 1 year ago

Cycle still ongoing: https://monitor.f-droid.org/builds/running

/LE: FYI https://gitlab.com/fdroid/wiki/-/wikis/FAQ#how-long-does-it-take-for-my-app-to-show-up-on-website-and-client

licaon-kter commented 1 year ago

and again

ref: https://monitor.f-droid.org/builds/log/oss.krtirtho.spotube/18#site-footer

ref: https://github.com/KRTirtho/metadata_god/issues/9

KRTirtho commented 1 year ago

I'll make an MR with the fix

licaon-kter commented 1 year ago

It was more than this: https://gitlab.com/fdroid/fdroiddata/-/commit/c7e38b623e8dad0b1a521b716bfeaf4e4d70bd6e ? :)

Builds fine

KRTirtho commented 1 year ago

Man I fixed it already but forgot to create an MR 😂 All 3 hours in vain 🥲 Great work btw! Sorry for all the trouble ❤️

licaon-kter commented 1 year ago

Recipe needs an update

So fails with: https://gitlab.com/fdroid/fdroiddata/-/jobs/4580191732#L779

Looks like maybe you forgot to bump flutter version? https://github.com/KRTirtho/spotube/blob/v3.0.0/.fvm/fvm_config.json#L2

Let me set it to 3.10.5 (latest stable) locally

Error when reading 'bin/create-secrets.dart': No such file or directory.

Oh... https://github.com/KRTirtho/spotube/tree/v3.0.0/bin

What now?

/LE: fyi https://gitlab.com/fdroid/fdroiddata/-/commit/27476875c11e7f423a2cf239d03323dffdaf9100

KRTirtho commented 1 year ago

Oops sorry. I always forget to update F-Droid scripts

KRTirtho commented 1 year ago

I'll update it and create a MR

KRTirtho commented 1 year ago

Closing as it is resolved now

It can be re-opened if same issue is face again

linsui commented 1 year ago

We need the lastFmApiKey for 3.2.0. Could you please update the metadata? Thanks!

KRTirtho commented 1 year ago

Yea sure sure. Why do I always forget about F-Droid! :facepalm:

KRTirtho commented 1 year ago

Please check https://gitlab.com/fdroid/fdroiddata/-/merge_requests/13873