babariviere / flutter-nix-hello-world

Demonstration on how to use flutter with Nix
51 stars 10 forks source link

Does not work on NixOS #32

Open MikiVanousek opened 7 months ago

MikiVanousek commented 7 months ago
flutter-nix-hello-world on  master is 📦 v1.0.0+1 via 🎯 
❯ nix develop

flutter-nix-hello-world on  master is 📦 v1.0.0+1 via 🎯 v3.3.0 via ❄️  impure (nix-shell-env) 
❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.0, on NixOS 24.05 (Uakari) 6.6.19, locale en_IE.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 2 categories.

flutter-nix-hello-world on  master is 📦 v1.0.0+1 via 🎯 v3.3.0 via ❄️  impure (nix-shell-env) 

❯ flutter build apk

Upgrading build.gradle
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

AAPT2 aapt2-7.4.2-8841542-linux Daemon #0: Unexpected error output: Could not start dynamically linked executable: /home/miki/.gradle/caches/transforms-3/875b87247ba2d6e937c30013ee3ad308/transformed/aapt2-7.4.2-8841542-linux/aapt2
AAPT2 aapt2-7.4.2-8841542-linux Daemon #0: Unexpected error output: NixOS cannot run dynamically linked executables intended for generic
AAPT2 aapt2-7.4.2-8841542-linux Daemon #0: Unexpected error output: linux environments out of the box. For more information, see:
AAPT2 aapt2-7.4.2-8841542-linux Daemon #0: Unexpected error output: https://nix.dev/permalink/stub-ld
AAPT2 aapt2-7.4.2-8841542-linux Daemon #1: Unexpected error output: Could not start dynamically linked executable: /home/miki/.gradle/caches/transforms-3/875b87247ba2d6e937c30013ee3ad308/transformed/aapt2-7.4.2-8841542-linux/aapt2
AAPT2 aapt2-7.4.2-8841542-linux Daemon #1: Unexpected error output: NixOS cannot run dynamically linked executables intended for generic
AAPT2 aapt2-7.4.2-8841542-linux Daemon #1: Unexpected error output: linux environments out of the box. For more information, see:
AAPT2 aapt2-7.4.2-8841542-linux Daemon #1: Unexpected error output: https://nix.dev/permalink/stub-ld
AAPT2 aapt2-7.4.2-8841542-linux Daemon #2: Unexpected error output: Could not start dynamically linked executable: /home/miki/.gradle/caches/transforms-3/875b87247ba2d6e937c30013ee3ad308/transformed/aapt2-7.4.2-8841542-linux/aapt2
AAPT2 aapt2-7.4.2-8841542-linux Daemon #2: Unexpected error output: NixOS cannot run dynamically linked executables intended for generic
AAPT2 aapt2-7.4.2-8841542-linux Daemon #2: Unexpected error output: linux environments out of the box. For more information, see:
AAPT2 aapt2-7.4.2-8841542-linux Daemon #2: Unexpected error output: https://nix.dev/permalink/stub-ld

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > AAPT2 aapt2-7.4.2-8841542-linux Daemon #0: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > AAPT2 aapt2-7.4.2-8841542-linux Daemon #1: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > AAPT2 aapt2-7.4.2-8841542-linux Daemon #2: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Running Gradle task 'assembleRelease'...                            4.7s
Gradle task assembleRelease failed with exit code 1

flutter-nix-hello-world on  master [!] is 📦 v1.0.0+1 via 🎯 v3.3.0 via ❄️  impure (nix-shell-env) took 5s 
❯ 
MikiVanousek commented 7 months ago

I found a discussion of the issue here. https://github.com/NixOS/nixpkgs/issues/267263

MikiVanousek commented 7 months ago

I managed to fix it, but it requires a patch not yet in nixpkgs-unstable. I will try to submit it later, if someone needs a working flake urgently, let me know.

Hassel2 commented 7 months ago

I managed to fix it, but it requires a patch not yet in nixpkgs-unstable. I will try to submit it later, if someone needs a working flake urgently, let me know.

Any news? Can you please provide any instructions to fix that? I need my university work to be done soon.

MikiVanousek commented 7 months ago

This should work, make sure you are pulling the fix branch. https://github.com/MikiVanousek/flutter-nix-hello-world/tree/fix

Hassel2 commented 7 months ago

This should work, make sure you are pulling the fix branch. https://github.com/MikiVanousek/flutter-nix-hello-world/tree/fix

Yeah, it's working, thx!