Questions tagged [jniwrapper]

54 questions
8
votes
1 answer

Unit Testing JNI Calls

I have an Android JNI wrapper for some C++ code. The C++ code has it's own set of unit tests. I want to write Java unit-tests for the JNI wrapper class. Is there a way to unit-test the Android JNI .so wrapper API from the desktop console e.g. on…
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
6
votes
3 answers

How can I map the following elements of a C Structure to Java?

I have the following C Structure which needs to be mapped to Java. Because I need to call a method from a DLL generated from the C code. The following is my structure. typedef struct _ipj_iri_device { IPJ_READER_CONTEXT …
AnOldSoul
  • 4,017
  • 12
  • 57
  • 118
6
votes
0 answers

JNI - SetByteArrayRegion does not work

I had some problems about encoding/decoding audio in my wrapper code, I debugged my code and finally found out that SetByteArrayRegion does not work as expected. Here we go: // incoming parameters => jbyteArray jencoded jbyte encoded[320]; // ... //…
Ramazan
  • 989
  • 3
  • 14
  • 26
5
votes
2 answers

C++ application with JNI throws an error "jvm.dll not found . re-installing the application could fix ...."

I have written a plain C++ application in VC6 that is using jni to call up a method in java. For doing so, I have included jni.h and other lib folders in the project directories. the code compiles but when i run teh application it fails saying…
user1821083
  • 71
  • 1
  • 5
4
votes
3 answers

How to convert the "Java modified UTF-8" to the regular UTF-8 and back?

I have created a Java wrapper around a native C library and have a question about the string encodings. There are slight differences in the “Java modified UTF-8” encoding that is used by Java from the regular UTF-8. And these differences may cause…
4
votes
2 answers

java.lang.UnsatisfiedLinkError: No implementation found due to Library not loading

I am trying out to integrate native written shared library into my app when it says that the .so file in jniLibs and other libraries cannot be loaded. Here is the C file #include #include #include JNIEXPORT…
4
votes
2 answers

How to use JNI to call JAVA method from C

I want to use JNI (Java Native Interface) to call a specific java setter method, passing a short[] buffer into it as a parameter. Java method implimentation looks as follows: public void setPcmLeft(short[] data) { pcm_l = data; } From inside my C…
Sabobin
  • 4,256
  • 4
  • 27
  • 33
3
votes
3 answers

Convert JNI -> jobject (basically map and/or map of map in java file) to std::map(c++)

I have a native method in java file:- class JNITest{ public native void test(String param1, Map param2, Map> param3) } After generating header file from java, map is converted to jobject in header…
3
votes
0 answers

dyld: lazy symbol binding failed: Symbol not found: Expected in: flat namespace

I recently updated OpenCv to version 3.2.0 and had to rewrite a few of my JNI wrappers as a result. However, now it is throwing me this error: dyld: lazy symbol binding failed: Symbol not found: ZN2cv4MSER6createEiiiddiddi Referenced from:…
3
votes
1 answer

JNI in C++ to read file to jbyteArray

I am writing a C++ program in UNIX to generate a shared library which will be called in java using JNI. This C++ program has to read a file in UNIX box then it will have to be converted into jbyteArray (JNI data type) so that JAVA can use it. I…
Renga
  • 119
  • 1
  • 3
  • 12
2
votes
2 answers

*** No rule to make target `src/main/jni/Build.config'. Stop

Since I downgraded my NDK version to 14-16 (because of no GCC support in newer versions), I am facing this error *** No rule to make target `src/main/jni/Build.config'. Stop I can't understand why in the old versions of the NDK it says no such file…
gesha
  • 79
  • 7
2
votes
0 answers

Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing in AOSP Build

Hi all I am using jni code to generate some number in my application. When I install and run it on my device it is working fine as expected with jni code, but when I am creating AOSP build flashing system.img and boot.img in my device getting…
2
votes
0 answers

Java JNI slows down unexpected

I'm trying to implement a java wrapper for RCSwitch in a Raspberry Pi. It works fine until the grabbing method reaches the 80th iteration. Then it slows down and I can't figure out why. It needs more than 5 minutes to return with a value. I tried to…
blase
  • 67
  • 1
  • 8
2
votes
1 answer

How to make a synchronous\asynchronous native call from Java

I am developing a chess game for Android, and planning use a AI engine written in C++. So, I have to make a native method call from Java to C++. The sources look like this: Computer.java class Computer{ public native String dumpMethod(); …
huynq9
  • 522
  • 8
  • 22
1
vote
1 answer

Access array in native code (NDK) from Java (SDK) via JNI

I want to access an array that is created and updated in the native C code efficiently. If need be, i could send a pointer or reference from Java code to the native side and have the C-code populate it so that i can read it from SDK side when it's…
1
2 3 4