diff --git a/ndk-build/src/error.rs b/ndk-build/src/error.rs index 9dee031..2d2be0b 100644 --- a/ndk-build/src/error.rs +++ b/ndk-build/src/error.rs @@ -8,13 +8,13 @@ use thiserror::Error; pub enum NdkError { #[error( "Android SDK is not found. \ - Please set the path to the Android SDK with the $ANDROID_SDK_ROOT \ + Please set the path to the Android SDK with the $ANDROID_HOME \ environment variable." )] SdkNotFound, #[error( "Android NDK is not found. \ - Please set the path to the Android NDK with $ANDROID_NDK_ROOT \ + Please set the path to the Android NDK with $NDK_HOME \ environment variable." )] NdkNotFound, diff --git a/ndk-build/src/ndk.rs b/ndk-build/src/ndk.rs index 962ce93..52eecf1 100644 --- a/ndk-build/src/ndk.rs +++ b/ndk-build/src/ndk.rs @@ -85,8 +85,10 @@ impl Ndk { .max() .ok_or(NdkError::BuildToolsNotFound)?; - let build_tag = std::fs::read_to_string(ndk_path.join("source.properties")) - .expect("Failed to read source.properties"); + let Ok(build_tag) = std::fs::read_to_string(ndk_path.join("source.properties")) else { + eprintln!("Failed to read source.properties. Maybe NDK is not at {:?}.", ndk_path); + return Err(NdkError::NdkNotFound); + }; let build_tag = build_tag .split('\n')