Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/minimal/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/sdl2/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down
33 changes: 19 additions & 14 deletions src/androidbuild/tools.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down