From d9ac83428842d6c55ce10a5d9a6039673dfc9be3 Mon Sep 17 00:00:00 2001 From: clemens Date: Fri, 17 Oct 2025 05:53:20 +0000 Subject: [PATCH 1/2] working apk build --- .../reports/problems/problems-report.html | 663 ++++++++++++++++++ demo_app/flake.lock | 61 ++ demo_app/flake.nix | 44 ++ demo_app/flake.nix.old | 66 ++ demo_app/pubspec.yaml | 2 +- demo_app/shell.nix | 23 + 6 files changed, 858 insertions(+), 1 deletion(-) create mode 100644 demo_app/android/build/reports/problems/problems-report.html create mode 100644 demo_app/flake.lock create mode 100644 demo_app/flake.nix create mode 100644 demo_app/flake.nix.old create mode 100644 demo_app/shell.nix diff --git a/demo_app/android/build/reports/problems/problems-report.html b/demo_app/android/build/reports/problems/problems-report.html new file mode 100644 index 0000000..82f1995 --- /dev/null +++ b/demo_app/android/build/reports/problems/problems-report.html @@ -0,0 +1,663 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/demo_app/flake.lock b/demo_app/flake.lock new file mode 100644 index 0000000..5b83b57 --- /dev/null +++ b/demo_app/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1760524057, + "narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/demo_app/flake.nix b/demo_app/flake.nix new file mode 100644 index 0000000..44e9141 --- /dev/null +++ b/demo_app/flake.nix @@ -0,0 +1,44 @@ +{ +description = "Flutter 3.13.x"; +inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; +}; +outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + config = { + android_sdk.accept_license = true; + allowUnfree = true; + }; + }; + androidComposition = pkgs.androidenv.composeAndroidPackages { + buildToolsVersions = [ "35.0.0" ]; + platformVersions = [ "36" ]; + abiVersions = [ "x86_64" ]; + includeSystemImages = true; + systemImageTypes = [ "google_apis" ]; + includeEmulator = true; + includeNDK = true; + ndkVersions = [ "27.0.12077973" ]; + cmakeVersions = [ "3.22.1" ]; + }; + androidSdk = androidComposition.androidsdk; + in + { + devShell = + with pkgs; mkShell rec { + NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE = "1"; + ANDROID_HOME = "${androidSdk}/libexec/android-sdk"; + buildInputs = [ + flutter + pkg-config + androidSdk # The customized SDK that we've made above + androidComposition.emulator # The emulator component + jdk17 + ]; + }; + }); +} \ No newline at end of file diff --git a/demo_app/flake.nix.old b/demo_app/flake.nix.old new file mode 100644 index 0000000..c4ea431 --- /dev/null +++ b/demo_app/flake.nix.old @@ -0,0 +1,66 @@ +{ + description = "Flutter development environment with Android SDK on Nix."; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let + + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + config.android_sdk.accept_license = true; + }; + + # Define the composed Android SDK derivation + androidEnvComposition = pkgs.androidenv.composeAndroidPackages { + cmdLineToolsVersion = "latest"; + platformToolsVersion = "latest"; + buildToolsVersions = [ "34.0.0" ]; + platformVersions = [ "34" ]; + includeSystemImages = true; + systemImageTypes = [ "google_apis" ]; + includeEmulator = true; + }; + + # The actual SDK path derivation is the 'androidsdk' attribute + androidSdkPath = androidEnvComposition.androidsdk; + + in { + devShell = pkgs.mkShell { + + # --- Environment Variables --- + # ANDROID_HOME points to the root of the assembled SDK + ANDROID_HOME = "${androidSdkPath}"; + ANDROID_SDK_ROOT = "${androidSdkPath}"; + JAVA_HOME = "${pkgs.jdk17}"; + FLUTTER_ROOT = "${pkgs.flutter}"; + + # --- CORRECTED PATH DEFINITION --- + # Add the 'bin' directory which holds ALL the necessary tools (adb, sdkmanager, etc.) + PATH = [ + "${androidSdkPath}/bin" + "${androidEnvComposition.emulator}" # Keep the emulator path separate for the executable + ]; + + # --- Build Inputs --- + buildInputs = with pkgs; [ + flutter + jdk17 + androidSdkPath # The main SDK derivation + androidEnvComposition.emulator # The emulator component + ]; + + shellHook = '' + echo "Flutter and Android SDK environment is active." + # Explicitly set SDK paths again just before flutter doctor as a safeguard + export ANDROID_HOME="${androidSdkPath}" + export ANDROID_SDK_ROOT="${androidSdkPath}" + flutter doctor + ''; + }; + }); +} \ No newline at end of file diff --git a/demo_app/pubspec.yaml b/demo_app/pubspec.yaml index d62ec33..df26cd7 100644 --- a/demo_app/pubspec.yaml +++ b/demo_app/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ^3.9.2 + sdk: ^3.5.4 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/demo_app/shell.nix b/demo_app/shell.nix new file mode 100644 index 0000000..b1914d2 --- /dev/null +++ b/demo_app/shell.nix @@ -0,0 +1,23 @@ +let + pkgs = import {}; + # Define the android environment here, similar to your flake + androidSdk = pkgs.androidenv.composeAndroidPackages { + # ... your android tool versions and system image settings ... + # This part gets complex without the flake structure + }; +in + pkgs.mkShell { + buildInputs = with pkgs; [ + flutter + androidSdk + jdk17 + ]; + + # Set environment variables + shellHook = '' + export ANDROID_HOME="${androidSdk}/libexec/android-sdk" + export ANDROID_SDK_ROOT="${androidSdk}/libexec/android-sdk" + export JAVA_HOME="${pkgs.jdk17}" + flutter doctor + ''; + } \ No newline at end of file From bb5b7c4337a1b7692dfb97063508b2cc9481aff5 Mon Sep 17 00:00:00 2001 From: clemens Date: Fri, 17 Oct 2025 05:53:54 +0000 Subject: [PATCH 2/2] rm shell.nix --- demo_app/shell.nix | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 demo_app/shell.nix diff --git a/demo_app/shell.nix b/demo_app/shell.nix deleted file mode 100644 index b1914d2..0000000 --- a/demo_app/shell.nix +++ /dev/null @@ -1,23 +0,0 @@ -let - pkgs = import {}; - # Define the android environment here, similar to your flake - androidSdk = pkgs.androidenv.composeAndroidPackages { - # ... your android tool versions and system image settings ... - # This part gets complex without the flake structure - }; -in - pkgs.mkShell { - buildInputs = with pkgs; [ - flutter - androidSdk - jdk17 - ]; - - # Set environment variables - shellHook = '' - export ANDROID_HOME="${androidSdk}/libexec/android-sdk" - export ANDROID_SDK_ROOT="${androidSdk}/libexec/android-sdk" - export JAVA_HOME="${pkgs.jdk17}" - flutter doctor - ''; - } \ No newline at end of file