Correctly build android app

This commit is contained in:
Ryan Pandya 2023-10-13 15:19:21 -07:00
parent d7ecab3415
commit e01bd9895e
4 changed files with 185 additions and 40 deletions

View File

@ -48,7 +48,7 @@ android {
applicationId "com.ryanpandya.lifetracker" applicationId "com.ryanpandya.lifetracker"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion 19 //flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName

113
ltx_flutter/flake.lock generated
View File

@ -1,8 +1,68 @@
{ {
"nodes": { "nodes": {
"android-nixpkgs": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1695500385,
"narHash": "sha256-bpTF7H5fjfZMwgU8/W28FPgkyTf2rYTVUMBgmMskk44=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "a85aaf82d9c29b41e37bc0babd3f69632dfdbaf1",
"type": "github"
},
"original": {
"owner": "tadfisher",
"repo": "android-nixpkgs",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"android-nixpkgs",
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1695195896,
"narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=",
"owner": "numtide",
"repo": "devshell",
"rev": "05d40d17bf3459606316e3e9ec683b784ff28f16",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1694529238,
@ -19,6 +79,22 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1695145219,
"narHash": "sha256-Eoe9IHbvmo5wEDeJXKFOpKUwxYJIOxKUesounVccNYk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5ba549eafcf3e33405e5f66decd1a72356632b96",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1685566663, "lastModified": 1685566663,
"narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=", "narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=",
@ -36,8 +112,9 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "android-nixpkgs": "android-nixpkgs",
"nixpkgs": "nixpkgs" "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
} }
}, },
"systems": { "systems": {
@ -54,6 +131,36 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"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", "root": "root",

View File

@ -1,38 +1,76 @@
{ {
description = "Flutter 3.0.4"; description = "moxplatform";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/23.05"; # nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:NixOS/nixpkgs/23.05";
}; flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }: android-nixpkgs.url = "github:tadfisher/android-nixpkgs";
flake-utils.lib.eachDefaultSystem (system: };
let
pkgs = import nixpkgs { outputs = { self, nixpkgs, flake-utils, android-nixpkgs }: flake-utils.lib.eachDefaultSystem (system: let
inherit system; pkgs = import nixpkgs {
config = { inherit system;
android_sdk.accept_license = true; config = {
allowUnfree = true; android_sdk.accept_license = true;
}; allowUnfree = true;
}; };
buildToolsVersion = "30.0.3"; };
androidComposition = pkgs.androidenv.composeAndroidPackages { # Everything to make Flutter happy
buildToolsVersions = [ buildToolsVersion "28.0.3" ]; sdk = android-nixpkgs.sdk.${system} (sdkPkgs: with sdkPkgs; [
platformVersions = [ "31" "28" ]; cmdline-tools-latest
abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; build-tools-30-0-3
}; build-tools-33-0-2
androidSdk = androidComposition.androidsdk; build-tools-34-0-0
in platform-tools
{ emulator
devShell = patcher-v4
with pkgs; mkShell rec { platforms-android-30
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; platforms-android-31
buildInputs = [ platforms-android-33
chromium ]);
flutter pinnedJDK = pkgs.jdk17;
androidSdk in {
jdk11 devShell = pkgs.mkShell {
android-studio buildInputs = with pkgs; [
]; # Android
}; pinnedJDK
}); sdk
# Flutter
flutter dart
# Code hygiene
gitlint
# Flutter dependencies for linux desktop
atk
cairo
clang
cmake
epoxy
gdk-pixbuf
glib
gtk3
harfbuzz
ninja
pango
pcre
pkg-config
xorg.libX11
xorg.xorgproto
];
# Make Flutter build on desktop
CPATH = "${pkgs.xorg.libX11.dev}/include:${pkgs.xorg.xorgproto}/include";
LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ atk cairo epoxy gdk-pixbuf glib gtk3 harfbuzz pango ];
ANDROID_HOME = "${sdk}/share/android-sdk";
ANDROID_SDK_ROOT = "${sdk}/share/android-sdk";
JAVA_HOME = pinnedJDK;
# Fix an issue with Flutter using an older version of aapt2, which does not know
# an used parameter.
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdk}/share/android-sdk/build-tools/34.0.0/aapt2";
};
});
} }

View File

@ -3,7 +3,7 @@ description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.1+1 version: 0.1.0+1
environment: environment:
sdk: '>=2.19.4 <4.0.0' sdk: '>=2.19.4 <4.0.0'