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

  • SEARCH
  • Home
  • 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 8328407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:26:01+00:00 2026-06-09T01:26:01+00:00

im trying to implement a native library into my application. But i keep getting

  • 0

im trying to implement a native library into my application. But i keep getting errors no matter what i try. So im asking for a little help!

The functions for the lib is stored java-wise in this class:

public class CamLib {

static{
    System.loadLibrary("leifdev_com_WaveNet_CamLib");
}
public static native void getSobel(byte[] frame, int width, int height, IntBuffer diff);


}

And is being loaded in like this:

 CamLib.getSobel(mFrame, mFrameSize.width, mFrameSize.height, mFrameDiff);

The header file is auto generated by javah and looks like this:

  /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
#include <string.h>
#include <android/log.h>
/* Header for class leifdev_com_WaveNet_CamLib */

#ifndef _Included_leifdev_com_WaveNet_CamLib
#define _Included_leifdev_com_WaveNet_CamLib
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     leifdev_com_WaveNet_CamLib
 * Method:    getSobel
 * Signature: (J)J
 */
JNIEXPORT void JNICALL Java_leifdev_com_WaveNet_CamLib_getSobel
  (JNIEnv *, jclass,
        jbyteArray , jint , jint , jobject );


#ifdef __cplusplus
}
#endif
#endif

And the function itself is from a tutorial, so i assume its working, and it looks like this:

 #include "leifdev_com_WaveNet_CamLib.h"

#define LOGTAG "Sobel_Native"

JNIEXPORT void JNICALL Java_leifdev_com_WaveNet_CamLib_getSobel(
JNIEnv *env, jclass c,
jbyteArray frame, jint width, jint height, jobject diff)
{
jboolean framecopy;
jint *dbuf = (jint*)((*env)->GetDirectBufferAddress(env, diff));
jbyte *fbuf = (*env)->GetByteArrayElements(env, frame, &framecopy);
int x, y, maxx=width-1, maxy=height-1, p=width+1, px, py, ps;

for(y=1; y<maxy; y++, p+=2)
{
    for(x=1; x<maxx; x++, p++)
    {
        px = fbuf[p+width+1]-fbuf[p+width-1]+fbuf[p+1]+fbuf[p+1]-fbuf[p-1]-fbuf[p-1]+fbuf[p-width+1]-fbuf[p-width-1];
        py = fbuf[p-width-1]+fbuf[p-width]+fbuf[p-width]+fbuf[p-width+1]-fbuf[p+width-1]-fbuf[p+width]-fbuf[p+width]-fbuf[p+width+1];
        if(px<0) px=-px; if(py<0) py=-py;
        ps=px+py; if(ps>95) ps=255; if(ps<=95) ps=0;
        dbuf[p] = (ps<<24)|(ps<<16)|(ps<<8)|ps;

    }
}
}

I am assuming these are the logcat messages of most importance:

 08-02 02:07:17.204: D/dalvikvm(15767): No JNI_OnLoad found in /data/data/leifdev.com/lib/libleifdev_com_WaveNet_CamLib.so 0x41a02998, skipping init
 08-02 02:07:17.204: W/dalvikvm(15767): No implementation found for native Lleifdev/com/CamLib;.getSobel ([BIILjava/nio/IntBuffer;)V
 08-02 02:07:17.204: D/AndroidRuntime(15767): Shutting down VM
 08-02 02:07:17.204: W/dalvikvm(15767): threadid=1: thread exiting with uncaught exception (group=0x40c631f8)
 08-02 02:07:17.219: V/Camera-JNI(15767): dataCallback(16, 0x7f5778)
 08-02 02:07:17.224: V/Camera-JNI(15767): copyAndPost: off=0, size=1036800
 08-02 02:07:17.224: V/Camera-JNI(15767): Allocating callback buffer
 08-02 02:07:17.334: E/AndroidRuntime(15767): FATAL EXCEPTION: main
 08-02 02:07:17.334: E/AndroidRuntime(15767): java.lang.UnsatisfiedLinkError: getSobel
 08-02 02:07:17.334: E/AndroidRuntime(15767):   at leifdev.com.CamLib.getSobel(Native Method)

(Sorry for spelling errors, its getting really late.)

I have been stuck at this stage for a couple of days now, i think it has something to do with using jclass instead of jobject in the native header, but i cant really find any documentation on it.
So if any of you black wizards of ndk could help me out, i would be really happy!

  • 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-09T01:26:03+00:00Added an answer on June 9, 2026 at 1:26 am

    LogCat says your class CamLib should be in leifdev.com package, but your JNI function expects it to be in leifdev.com.WaveNet

    So rename your JNI function to Java_leifdev_com_CamLib_getSobel

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

Sidebar

Related Questions

I am trying implement a most recent widget into my tumblr post. So far,
I'm trying to wrap a C++ library (libclang) into a C# wrapper, using PInvoke.
I am trying to implement Facebook Connect into my program. More specifically I am
I'm trying to implement the XHR streaming Comet technique in jQuery, but am having
Hi I'm trying to implement a bluetooth library and in it I want to
I am trying to implement support for WebKit's native desktop notifications on my site.
Hey, I'm trying to implement two tabs. Each one calls a specifig activity. But
I'm trying to implement a Java/C++ binding for a sound streaming class. To keep
I have an MFC application compiled with /clr and I'm trying to implement a
I'm trying to evaluate whether to implement my application as a Web App or

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.