Commit 8fa6f63e5d7c6054d8d45ca8b37525567872ae54
Committed by
Adeel Kazmi
1 parent
9b6fc4d8
Add ERROR message in the case of serious error
output an error message through logcat regardless release/debug build also exit with an non-zero exit code so that it won't fall into infinite loop Change-Id: Ib078a7c26a0bfc855f284f3103878e0b94ea1dfa
Showing
1 changed file
with
8 additions
and
1 deletions
build/android/app/src/main/cpp/main.cpp
| ... | ... | @@ -29,8 +29,11 @@ |
| 29 | 29 | #include <dlfcn.h> |
| 30 | 30 | |
| 31 | 31 | // from android_native_app_glue.c |
| 32 | + | |
| 33 | +#define TAG "dalidemo" | |
| 34 | +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG, ##__VA_ARGS__)) | |
| 32 | 35 | #ifndef NDEBUG |
| 33 | -#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, "dalidemo", __VA_ARGS__)) | |
| 36 | +#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG, ##__VA_ARGS__)) | |
| 34 | 37 | #else |
| 35 | 38 | #define LOGV(...) ((void)0) |
| 36 | 39 | #endif |
| ... | ... | @@ -153,6 +156,7 @@ void android_main(struct android_app* state) |
| 153 | 156 | LOGV("android_main() >>"); |
| 154 | 157 | |
| 155 | 158 | std::string filesDir = state->activity->internalDataPath; |
| 159 | + LOGV("filesDir=%s", filesDir.c_str() ); | |
| 156 | 160 | |
| 157 | 161 | std::string fontconfigPath = filesDir + "/fonts"; |
| 158 | 162 | setenv("FONTCONFIG_PATH", fontconfigPath.c_str(), 1); |
| ... | ... | @@ -198,6 +202,9 @@ void android_main(struct android_app* state) |
| 198 | 202 | void* handle = dlopen(libpath.c_str(), RTLD_LAZY); |
| 199 | 203 | if(!handle) |
| 200 | 204 | { |
| 205 | + int err = errno; | |
| 206 | + LOGE("Err=%d Fail to open lib %s", err, libpath.c_str()); | |
| 207 | + status = err; | |
| 201 | 208 | std::exit(status); |
| 202 | 209 | } |
| 203 | 210 | ... | ... |