devbox setup, dep upgrades, lint fixes, Android build fixes

- Add devbox.json pinning Flutter 3.35.7, Android SDK (Nix flake),
  openjdk17, just, openssl
- Add android/nix-android-sdk/ Nix flake + flake.lock + Android Studio
  config script
- Add justfile with build/get/upgrade/icons/analyze/rebuild recipes
- flutter pub upgrade --major-versions: file_picker ^11, google_fonts ^8,
  permission_handler ^12, share_plus ^12, flutter_lints ^6 (+71 transitive)
- Fix file_picker v11 API: FilePicker.platform → FilePicker.getDirectoryPath()
- Fix all 37 analyzer issues: deprecated APIs (window, WillPopScope, Share,
  SvgPicture color), async BuildContext guards, key constructors, private
  createState() return types, unused locals, print → debugPrint, etc.
- Hook _handleCommand into onSubmitted for : prefix commands
- Android: Gradle 8.3→8.11.1, AGP 8.2.2→8.9.1, KGP 1.8.22→2.2.20,
  compileSdk/targetSdk 34→36, namespace auto-derivation for library modules,
  kotlin.compiler.execution.strategy=in-process

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
randogoth 2026-06-19 17:08:29 +03:00
parent 9dbd638fa8
commit fc6c69db24
19 changed files with 1287 additions and 383 deletions

8
android/app/build.gradle Normal file → Executable file
View file

@ -6,10 +6,10 @@ plugins {
}
android {
namespace = "com.example.muzzlevelocity"
namespace = "vision.flux.muzzlevelocity"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileSdkVersion 34
compileSdkVersion 36
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
@ -22,14 +22,14 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.muzzlevelocity"
applicationId = "vision.flux.muzzlevelocity"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
targetSdkVersion 34
targetSdkVersion 36
}
buildTypes {

32
android/build.gradle Normal file → Executable file
View file

@ -7,10 +7,36 @@ allprojects {
rootProject.buildDir = "../build"
subprojects {
afterEvaluate { project ->
if (project.hasProperty("android")) {
project.android {
compileSdkVersion 36
}
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
project.evaluationDependsOn(':app')
plugins.withId('com.android.library') {
extensions.configure(com.android.build.gradle.LibraryExtension) { android ->
def manifestFile = android.sourceSets.main.manifest.srcFile
def packageName = null
if (manifestFile.exists()) {
def manifestContent = new XmlParser().parse(file(manifestFile))
packageName = manifestContent.@package
}
if (!android.hasProperty("namespace") || android.namespace == null || android.namespace.isEmpty()) {
if (packageName) {
println ">> Derived Namespace for: '${project.name}' to '${packageName}'"
android.namespace = packageName
} else {
def defaultNamespace = "com.example.${project.name}"
println "?? Made up Namespace for: '${project.name}' to '${defaultNamespace}'"
android.namespace = defaultNamespace
}
}
}
}
}
tasks.register("clean", Delete) {

2
android/gradle.properties Normal file → Executable file
View file

@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process

2
android/gradle/wrapper/gradle-wrapper.properties vendored Normal file → Executable file
View file

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip

View file

@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd -- "$SCRIPT_DIR/../.." && pwd)"
IDEA_DIR="$PROJECT_DIR/.idea"
LIBRARIES_DIR="$IDEA_DIR/libraries"
FLUTTER_SDK="$PROJECT_DIR/.devbox/nix/profile/default"
DART_SDK="$FLUTTER_SDK/bin/cache/dart-sdk"
mkdir -p "$IDEA_DIR"
if [ ! -x "$FLUTTER_SDK/bin/flutter" ]; then
echo "Flutter not found at $FLUTTER_SDK/bin/flutter. Run devbox install to download it." >&2
exit 1
fi
if [ ! -d "$DART_SDK" ]; then
echo "Dart SDK not found at $DART_SDK. Run flutter doctor to populate the cache." >&2
exit 1
fi
mkdir -p "$LIBRARIES_DIR"
cat > "$IDEA_DIR/flutter.xml" <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FlutterSdkSettings">
<option name="FLUTTER_SDK_PATH" value="$PROJECT_DIR$/.devbox/nix/profile/default" />
</component>
</project>
EOF
cat > "$IDEA_DIR/dart.xml" <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DartSdkGlobalLibSettings">
<option name="dartSdkPath" value="$PROJECT_DIR$/.devbox/nix/profile/default/bin/cache/dart-sdk" />
</component>
</project>
EOF
dart_libs=$(find "$DART_SDK/lib" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
tmp_file=$(mktemp)
{
echo '<component name="libraryTable">'
echo ' <library name="Dart SDK">'
echo ' <CLASSES>'
for lib in $dart_libs; do
printf ' <root url="file://$PROJECT_DIR$/.devbox/nix/profile/default/bin/cache/dart-sdk/lib/%s" />\n' "$lib"
done
echo ' </CLASSES>'
echo ' <JAVADOC />'
echo ' <SOURCES />'
echo ' </library>'
echo '</component>'
} > "$tmp_file"
mv "$tmp_file" "$LIBRARIES_DIR/Dart_SDK.xml"
echo "Android Studio configured. Flutter SDK: $FLUTTER_SDK"

136
android/nix-android-sdk/flake.lock generated Normal file
View file

@ -0,0 +1,136 @@
{
"nodes": {
"android-nixpkgs": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1768249546,
"narHash": "sha256-cpNxcSNveCBSDmocYlPrayaP8CX8ik0SKR4aNbrxOqA=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "001ffcb40e86888d38acf7b851f9a1bfac7d3a81",
"type": "github"
},
"original": {
"owner": "tadfisher",
"ref": "stable",
"repo": "android-nixpkgs",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"android-nixpkgs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1764011051,
"narHash": "sha256-M7SZyPZiqZUR/EiiBJnmyUbOi5oE/03tCeFrTiUZchI=",
"owner": "numtide",
"repo": "devshell",
"rev": "17ed8d9744ebe70424659b0ef74ad6d41fc87071",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"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"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"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": 1768127708,
"narHash": "sha256-1Sm77VfZh3mU0F5OqKABNLWxOuDeHIlcFjsXeeiPazs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ffbc9f8cbaacfb331b6017d5a5abb21a492c9a38",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"android-nixpkgs": "android-nixpkgs",
"flake-utils": "flake-utils_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"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"
}
}
},
"root": "root",
"version": 7
}

View file

@ -0,0 +1,27 @@
{
description = "A Flake for the Android SDK";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
android-nixpkgs.url = "github:tadfisher/android-nixpkgs/stable";
};
outputs = { self, flake-utils, android-nixpkgs }:
flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"] (system: {
packages.android-sdk = android-nixpkgs.sdk."${system}" (sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-33-0-0
build-tools-34-0-0
build-tools-35-0-0
build-tools-36-1-0
cmake-3-22-1
platform-tools
platforms-android-33
platforms-android-34
platforms-android-35
platforms-android-36
emulator
ndk-27-0-12077973
]);
});
}

4
android/settings.gradle Normal file → Executable file
View file

@ -18,8 +18,8 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "com.android.application" version "8.9.1" apply false
id "org.jetbrains.kotlin.android" version "2.2.20" apply false
}
include ":app"