Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The other posters have covered the out-of-memory issues. I'll just add that to debug your native code, one quick-and-dirty way is to add log messages at various checkpoints. Here's an example from one of my native cpp files:</p> <pre><code>#include &lt;android/log.h&gt; ... // Set to 1 to enable debug log traces... #define DEBUG 0 #define LOG_TAG "yourNativeCodeLogTag" #if DEBUG #define LOG_ERROR(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) #define LOG_WARN(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__) #define LOG_INFO(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) #define LOG_DEBUG(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) #else // if !DEBUG #define LOG_ERROR(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) #define LOG_WARN(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__) #define LOG_INFO(...) #define LOG_DEBUG(...) #endif // DEBUG ... extern "C" JNIEXPORT void JNICALL Java_com_whatever_package_YourClassName_jniInitializeLibrary(JNIEnv * env, jobject thiz, /* other irrelevant stuff here */) { LOG_DEBUG("Initializing native library.\n"); .... } </code></pre> <p>Finally, you will also need to add <code>-llog</code> to your LOCAL_LDLIBS variable in the relevant <code>*.mk</code> file. Then, you can get log messages from your native library in logcat.</p> <p>UPDATE: After seeing your updates, I think you should use the above technique to pepper log messages into your native <code>encode()</code> method to see exactly where it's crashes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload