Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8792707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:01:02+00:00 2026-06-13T23:01:02+00:00

I m doing ndk with java but got these error in logcat. 11-02 12:36:43.582:

  • 0

I m doing ndk with java but got these error in logcat.

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)

my java and native code are like this.I want to perform the addition of two arrays elements in native space.

JAVA 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<4;i++){

        matrix1[i]=1.0;
        matrix2[i]=2.0;

}
matrix3= additionfromJNI(matrix1,matrix2);

   for(int i=0;i<4;i++){

    matrix4= matrix4+ Double.toString(matrix3[i])+",";

  }

    tv.setText(matrix4);
    setContentView(tv);
  }

  static {
    System.loadLibrary("hello-jni");
  }

 }

NATIVE CODE

#include <string.h>
#include <jni.h>

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)->GetDoubleArrayElements(env,mat1, &isCopy1);
        jint n = (*env) -> GetArrayLength(env,mat1);

 jdouble* srcArrayElems2 = (*env)->GetDoubleArrayElements(env,mat2, &isCopy2);


   for(i=0; i<n; i++){

       result[i]=srcArrayElems1[i]+srcArrayElems2[i];

   }

   if (isCopy1 == JNI_TRUE) {

       (*env) -> ReleaseDoubleArrayElements(env,mat1, srcArrayElems1,     
         JNI_ABORT);

   }

   if (isCopy2 == JNI_TRUE) {

       (*env) -> ReleaseDoubleArrayElements(env,mat2, srcArrayElems2,  
            JNI_ABORT);

   }

     return result;

        }

can anybody help me to solve these problem…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:01:03+00:00Added an answer on June 13, 2026 at 11:01 pm

    You cannot return jdouble. You’ll have to create a jdoubleArray object by using NewDoubleArray and then setting the values from your jdouble.

    BTW the title does not reflect your actual problem. The JNI_OnLoad is not called since you haven’t defined one but that is not an error. It is logged as D which is a debug message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working implementation of NDK library and corresponding Java-class. But I am
I am doing NDK profiling for my project using android-ndk-profiler-3.1. I have made changes
Doing the getting started of Sinatra. I get this error: ./sinatra.rb:5: undefined method `get'
I use NDK to allocate large buffer for Java: allocNativeBuffer(JNIEnv* env, jobject cls, jlong
I'm totally new to scripting but I got sick and tired of compiling my
Doing this works in IE7: <a href= target=_blank>Link</a> But in IE8 it open a
Doing a code review I've stumbled over GWM in Java-Spring-GWT web-application. As this product
I'm starting out with the Android NDK and OpenGL. I know I'm doing something
I have a java project and now I want to add some NDK functionality.
Doing File.WriteAllText to a remote path throws UnauthorizedAccessException . When I open the file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.