Note that there are some explanatory texts on larger screens.

plurals
  1. POJNI_OnLoad not found skip init(): No such file or directory
    text
    copied!<p>I m doing ndk with java but got these error in logcat.</p> <pre><code>11-02 12:36:43.582: E/Trace(717): error opening trace file: No such file or directory (2) 11-02 12:36:43.902: D/dalvikvm(717): Trying to load lib /data/data/com.example.hellojni/lib/libhello-jni.so 0x411e35b8 11-02 12:36:43.918: D/dalvikvm(717): Added shared lib /data/data/com.example.hellojni/lib/libhello-jni.so 0x411e35b8 11-02 12:36:43.918: D/dalvikvm(717): No JNI_OnLoad found in /data/data/com.example.hellojni/lib/libhello-jni.so 0x411e35b8, skipping init 11-02 12:36:43.953: W/dalvikvm(717): Invalid indirect reference 0x2a00b9e0 in decodeIndirectRef 11-02 12:36:43.953: E/dalvikvm(717): VM aborting 11-02 12:36:43.953: A/libc(717): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 717 (xample.hellojni) </code></pre> <p>my java and native code are like this.I want to perform the addition of two arrays elements in native space.</p> <p>JAVA CODE</p> <pre><code>package com.example.hellojni; import android.app.Activity; import android.widget.TextView; import android.os.Bundle; public class HelloJni extends Activity{ public native double[] additionfromJNI(double[] array1,double[] array2); double matrix1[] = new double[4]; double matrix2[] = new double[4]; double matrix3[] = new double[4]; String matrix4 = ""; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); for(int i=0;i&lt;4;i++){ matrix1[i]=1.0; matrix2[i]=2.0; } matrix3= additionfromJNI(matrix1,matrix2); for(int i=0;i&lt;4;i++){ matrix4= matrix4+ Double.toString(matrix3[i])+","; } tv.setText(matrix4); setContentView(tv); } static { System.loadLibrary("hello-jni"); } } </code></pre> <p>NATIVE CODE</p> <pre><code>#include &lt;string.h&gt; #include &lt;jni.h&gt; jdoubleArray Java_com_example_hellojni_HelloJni_additionfromJNI ( JNIEnv* env,jobject thiz, jdoubleArray mat1 ,jdoubleArray mat2 ) { jboolean isCopy1; jboolean isCopy2; jsize length= 16; jint i=0; jdouble *result; jdouble* srcArrayElems1 = (*env)-&gt;GetDoubleArrayElements(env,mat1, &amp;isCopy1); jint n = (*env) -&gt; GetArrayLength(env,mat1); jdouble* srcArrayElems2 = (*env)-&gt;GetDoubleArrayElements(env,mat2, &amp;isCopy2); for(i=0; i&lt;n; i++){ result[i]=srcArrayElems1[i]+srcArrayElems2[i]; } if (isCopy1 == JNI_TRUE) { (*env) -&gt; ReleaseDoubleArrayElements(env,mat1, srcArrayElems1, JNI_ABORT); } if (isCopy2 == JNI_TRUE) { (*env) -&gt; ReleaseDoubleArrayElements(env,mat2, srcArrayElems2, JNI_ABORT); } return result; } </code></pre> <p>can anybody help me to solve these problem...</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