babariviere / flutter-nix-hello-world

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

Build APK does not work out of the box #28

Closed zh4ngx closed 9 months ago

zh4ngx commented 9 months ago

I get an error with "AAPT2" when I try to run flutter build apk after checking out the project. This is on NixOS.

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.
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > AAPT2 aapt2-7.4.2-8841542-linux Daemon #3: 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 #6: 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 #5: 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 #4: 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 #7: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
h4m6urg1r commented 9 months ago

Same here but this works for me, and I don't understand why.

zh4ngx commented 9 months ago

Same here but this works for me, and I don't understand why.

So the gradle opts line probably needs to point to a build-tools version that you have installed GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2";

buildToolsVersion = "34.0.0"

zh4ngx commented 9 months ago

Let me give it a try and see if I can narrow it down

h4m6urg1r commented 9 months ago

Same here but this works for me, and I don't understand why.

So the gradle opts line probably needs to point to a build-tools version that you have installed GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2";

buildToolsVersion = "34.0.0"

I tried this but it didn't work out for me

babariviere commented 9 months ago

An issue has been created upstream for this: https://github.com/NixOS/nixpkgs/issues/289936