diff --git a/examples/minimal/build.zig b/examples/minimal/build.zig index 0748f69..8c65842 100644 --- a/examples/minimal/build.zig +++ b/examples/minimal/build.zig @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void { } const android_tools = android.Tools.create(b, .{ .api_level = .android15, - .build_tools_version = "35.0.0", + .build_tools_version = "35.0.1", .ndk_version = "29.0.13113456", }); const apk = android.APK.create(b, android_tools); diff --git a/examples/sdl2/build.zig b/examples/sdl2/build.zig index 6b5c327..75342b6 100644 --- a/examples/sdl2/build.zig +++ b/examples/sdl2/build.zig @@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void { } const android_tools = android.Tools.create(b, .{ .api_level = .android15, - .build_tools_version = "35.0.0", + .build_tools_version = "35.0.1", .ndk_version = "29.0.13113456", // NOTE(jae): 2025-03-09 // Previously this example used 'ndk' "27.0.12077973". diff --git a/src/androidbuild/tools.zig b/src/androidbuild/tools.zig index 4ac0a1b..f7e04fd 100644 --- a/src/androidbuild/tools.zig +++ b/src/androidbuild/tools.zig @@ -133,6 +133,24 @@ pub fn create(b: *std.Build, options: Options) *Tools { var errors = std.ArrayList([]const u8).init(b.allocator); defer errors.deinit(); + if (jdk_path.len == 0) { + errors.append( + \\JDK not found. + \\- Download it from https://www.oracle.com/th/java/technologies/downloads/ + \\- Then configure your JDK_HOME environment variable to where you've installed it. + ) catch @panic("OOM"); + } + if (android_sdk_path.len == 0) { + errors.append( + \\Android SDK not found. + \\- Download it from https://developer.android.com/studio + \\- Then configure your ANDROID_HOME environment variable to where you've installed it." + ) catch @panic("OOM"); + } + if (errors.items.len > 0) { + printErrorsAndExit("unable to find required Android installation", errors.items); + } + // Get commandline tools path // - 1st: $ANDROID_HOME/cmdline-tools/bin // - 2nd: $ANDROID_HOME/tools/bin @@ -170,20 +188,7 @@ pub fn create(b: *std.Build, options: Options) *Tools { break :cmdlineblk cmdline_tools; }; - if (jdk_path.len == 0) { - errors.append( - \\JDK not found. - \\- Download it from https://www.oracle.com/th/java/technologies/downloads/ - \\- Then configure your JDK_HOME environment variable to where you've installed it. - ) catch @panic("OOM"); - } - if (android_sdk_path.len == 0) { - errors.append( - \\Android SDK not found. - \\- Download it from https://developer.android.com/studio - \\- Then configure your ANDROID_HOME environment variable to where you've installed it." - ) catch @panic("OOM"); - } else { + { // Check if build tools path is accessible // ie. $ANDROID_HOME/build-tools/35.0.0 std.fs.accessAbsolute(build_tools_path, .{}) catch |err| switch (err) {