diff options
-rw-r--r-- | platform/android/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | platform/android/jni/Application.mk | 5 | ||||
-rw-r--r-- | platform/android/jni/mupdf.c | 12 |
3 files changed, 15 insertions, 3 deletions
diff --git a/platform/android/AndroidManifest.xml b/platform/android/AndroidManifest.xml index de914658..29c20f84 100644 --- a/platform/android/AndroidManifest.xml +++ b/platform/android/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.artifex.mupdfdemo" android:versionCode="50" android:versionName="@string/version" + android:debuggable="false" android:installLocation="auto"> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> diff --git a/platform/android/jni/Application.mk b/platform/android/jni/Application.mk index 60909b6e..4cedaf8d 100644 --- a/platform/android/jni/Application.mk +++ b/platform/android/jni/Application.mk @@ -28,8 +28,13 @@ ifdef NDK_PROFILER APP_OPTIM := debug APP_CFLAGS := -O2 else +ifdef DEBUG +APP_OPTIM := debug +APP_CFLAGS := -DDEBUG +else APP_OPTIM := release endif +endif ifdef V8_BUILD APP_STL := stlport_static endif diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c index c701edde..a9484866 100644 --- a/platform/android/jni/mupdf.c +++ b/platform/android/jni/mupdf.c @@ -23,9 +23,6 @@ #define LOGT(...) __android_log_print(ANDROID_LOG_INFO,"alert",__VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) -/* Set to 1 to enable debug log traces. */ -#define DEBUG 0 - /* Enable to log rendering times (render each frame 100 times and time) */ #undef TIME_DISPLAY_LIST @@ -292,6 +289,15 @@ JNI_FN(MuPDFCore_openFile)(JNIEnv * env, jobject thiz, jstring jfilename) glo->resolution = 160; glo->alerts_initialised = 0; +#ifdef DEBUG + /* Try and send stdout/stderr to file in debug builds. This + * path may not work on all platforms, but it works on the + * LG G3, and it's no worse than not redirecting it anywhere + * on anything else. */ + freopen("/storage/emulated/0/Download/stdout.txt", "a", stdout); + freopen("/storage/emulated/0/Download/stderr.txt", "a", stderr); +#endif + filename = (*env)->GetStringUTFChars(env, jfilename, NULL); if (filename == NULL) { |