diff --git a/src/android/kiwixreader.cpp b/src/android/kiwixreader.cpp index 769f25286..fac6c0096 100644 --- a/src/android/kiwixreader.cpp +++ b/src/android/kiwixreader.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "org_kiwix_kiwixlib_JNIKiwixReader.h" #include "common/base64.h" @@ -33,16 +34,15 @@ JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReader( { std::string cPath = jni2c(filename, env); + __android_log_print(ANDROID_LOG_INFO, "kiwix", "Attempting to create reader with: %s", cPath.c_str()); Lock l; - kiwix::Reader* reader = nullptr; try { - reader = new kiwix::Reader(cPath); + kiwix::Reader* reader = new kiwix::Reader(cPath); + return reinterpret_cast(new Handle(reader)); } catch (...) { - std::cerr << "Unable to load ZIM " << cPath << std::endl; - reader = NULL; + __android_log_print(ANDROID_LOG_WARN, "kiwix", "Error opening ZIM file"); + return 0; } - - return reinterpret_cast(new Handle(reader)); } JNIEXPORT void JNICALL