Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

JNI Issue: Passing Java Runnable Object to JNI in Custom Gluon Attach Plugin

I am developing a custom Gluon Attach plugin and encountering issues with passing a Java Runnable object from Java to JNI. Despite reviewing the Gluon Attach plugin source code (which unfortunately ...
CTO - Abid Maqbool's user avatar
1 vote
0 answers
50 views

Using SWIG to handle char* argument that is modified by the method from Java to C++

I have a C++ method : class classA { public: bool methodA(const char* a, const int b, char* c); } This is used in the C++ application as follows: int q = 5; char returnOutput[512] = "...
Shreyak Mysore Shamprasad's user avatar
1 vote
1 answer
33 views

What could cause ART (Android Runtime) to deadlock while unloading a native library?

I have been trying to debug a non user perceivable crash in my app (I think it happens in the background) that originated from the Android Runtime due to possibly a deadlock/thread contention. ...
peakpeakt's user avatar
1 vote
1 answer
64 views

Why JNI env (JNI interface pointer) is thread specific?

Two doubts from JNI Design Overview docs: The JNI interface pointer is only valid in the current thread. A native method, therefore, must not pass the interface pointer from one thread to another. A ...
Jatin guglani's user avatar
0 votes
0 answers
51 views

I face the Java Problem MY program gave me error .UnsatisfiedLinkError but the file is they

I have a Java program that uses a native DLL file. It works perfectly on my development machine but fails with a UnsatisfiedLinkError or a "file not found" error when I run it on another ...
Hannan Sani's user avatar
1 vote
1 answer
44 views

Is it possible to create Android activity from JNI?

My app is C++, it creates a JNI JVM (raw JVM, with class path to some of my .class files). The JVM above is rather a core Java Virtual Machine without knowing about android. How to add class path to ...
Dan D.'s user avatar
  • 8,487
1 vote
1 answer
85 views

C++ JNI:Error occurred during initialization of VMFailed setting boot class path

First run main.exe it said can not find jvm.dll So I copy jvm.dll from C:\Program Files\Zulu\zulu-21\bin\server to ./ Then this is my workspace. ls jvm.dll main.cpp main.exe main.obj But second ...
kouhe3's user avatar
  • 59
0 votes
1 answer
91 views

Cannot load a native JNI library

I'm working on a Minecraft library for my own mods to use and i ran into a problem with JNI. I'm still new to the JNI and c++ stuff so i might've made a mistake but after hours of searching i didn't ...
Progames723's user avatar
1 vote
1 answer
65 views

Iterate through the ZipFile$ZipEntryIterator list using c++/JNI in Android

I am fairly new with cpp or jni in android. I have few lines of code in kotlin which I want to move it to cpp, reason being want to make the validation in bit more secure way. Kotlin code: val entries ...
04Ant01's user avatar
  • 13
0 votes
1 answer
82 views

How do I properly pre-load ASAN libraries on macOS with Java binary (JNI library) with SIP enabled

We have a large C++ library for which we have created Java bindings using SWIG (so a JNI shared library). We build for and run tests on many build platforms across macOS, Linux, and Windows; debug and ...
Nick Williams's user avatar
0 votes
0 answers
28 views

Call CallVoidMethod multiple time cause crash

I'm trying to use JSI and JNI in a React-Native app for sending ArrayBuffer without encoding data. For this, I have a C++ function receiveDataFromCpp(): extern "C" JNIEXPORT void JNICALL ...
Stéphane R.'s user avatar
  • 1,496
0 votes
0 answers
132 views

How to Reference Custom AIDL HAL Service in JNI Code (Android.bp)?

I have a custom setup where I need to interact with a custom HAL through IPC in an Android JNI service. The flow I am working on is: HMI -> CustomSensorManager -> AIDL -> Custom System ...
Aman Srivastava's user avatar
1 vote
1 answer
53 views

Unable to set timestamp on Android MediaCodec Image object from native c++ code

I have an created a queue to store images from ImageReader in cpp. while copying the queued items to the Image object from MediaCodec.getInputImage(index) method I'm facing an issue where the byte ...
Avaneesh's user avatar
2 votes
1 answer
96 views

Android Native Activity cannot FindClass from external AAR library

I'm trying to build a dynamic library (OpenXR api_layer) in c++ that communicates with a java SDK but I'm having issues with the JNI part of the implementation, from the OpenXR Create Layer function I ...
Naor Liron's user avatar
0 votes
0 answers
43 views

Unsatisfied Link Error error of Java Native Interface DLL

I have a strange problem with my Java JNI windows DLL program. I can load and run immaculately on Windows 10 machine on which the DLL program was developed. It provides basic camera interfaces using ...
underflow's user avatar
0 votes
0 answers
27 views

Use native windows dll with jni in android studio for composables previewing

Android studio's preview feature for composables is clearly useful.The problem is that it runs in windows natively and so all jni code one uses for android won't work. I've been trying to get ...
user14448's user avatar
1 vote
2 answers
100 views

AOSP System Service JNI /sys/class/gpio/export Permission Denied

I added a system shared JNI library which tries to export/read/write GPIOs. In file 'build/make/target/product/base_system.mk' PRODUCT_PACKAGES +=libarkgpiojni I added my jni library folder to "/...
Erkin E's user avatar
  • 11
0 votes
1 answer
81 views

Getting "no jniLLVM in java.library.path" error when using javacpp-preset/llvm

I am trying to use javacpp-presets/llvm but I am getting the error "no jniLLVM in java.library.path". I am using intellij and set the path in the configuration in vm options to -Djava....
user27089969's user avatar
-1 votes
1 answer
38 views

c++ using JNI: AttachCurrentThread returns -1

I use the JNI in a cpp project, and JNI_GetCreatedJavaVMs is the function how I get JavaVM*. In the project, there is one cpp function which use JNI. And I when use it in one func, it works well. But ...
poiu144's user avatar
0 votes
0 answers
30 views

How do I debug a JNI dll using Visual Studio C++ debugger?

I have written a JNI library. It works fine when running in java.exe - the output from printf in the C code is shown in the console. However, when I run java.exe from the Visual studio debugger - the ...
Dmitry Negoda's user avatar
0 votes
1 answer
23 views

Compiler opton for detecting missing JNI prototypes?

While going through the exercise of renaming my namespace, I occasionally get tripped up by a situation where the function definitions incorporate the OLD packagename in the fct name. For example: ...
Charles Martin's user avatar
-1 votes
1 answer
100 views

Unable to CMAKE on Mac M2 - JNI was not found

I am trying to build SUMO on MAC M2, I am following the instructions from this source. When I initiate cmake -B build, I get the following error: -- CMAKE_BINARY_DIR: /Users/daspr/sumo/build -- ...
Pragyaditya Das's user avatar
0 votes
1 answer
42 views

bazel c++ program which used JNI, how to deal with the path of the .jar with relative path

bazel make a bazel-bin at last, my c++ codes can't find the relative path of jar at last. options[1].optionString = (char*)"-Djava.class.path=.:JavaNativeInterface.jar" I try genrule in ...
poiu144's user avatar
1 vote
3 answers
84 views

How to deal with function pointers in JNI?

I have a C function that accepts a function pointer. This function may be called multiple times. The function pointer of each call will be recorded and may be used in the future. How do I pass a java ...
artly's user avatar
  • 11
1 vote
2 answers
54 views

JNI: Generated file name and functions are cumbersome

I decided to put my Java "native"-methods class in some package within my program. When I call javac -h on that java class, it generates a file named com_example_foo_baz_MyJniInterface.h The ...
ron.jr's user avatar
  • 13
0 votes
0 answers
43 views

How to attach visual studio code to a java process on linux loading *.so files via JNI

I have the following setup on our debug machines: wsl running Ubuntu linux, main code is written in C++ and exposed as shared objects, compilation done using g++, these shared objects are then loaded ...
JJ Moore's user avatar
0 votes
0 answers
58 views

JNI Crashing when using from other header file

When i try to use the JNI pointer from another file, the main process crashes, not sure how to look up the crash reason neither. I've a cpp header file to handle java stuff using ...
Lucas Bois's user avatar
0 votes
0 answers
19 views

"event : nua_r_register status : 503 phrase : DNS Error" from sofia-sip in Android Client

I have cross compiled sofia-sip for Android and trying to register a sip server but getting 503 DNS error. I have followed the reference documentation. Sharing the code snippets and logs below: ...
Manoj Kumar's user avatar
0 votes
1 answer
148 views

Cocos2d-x project crashes only on android 14 (SDK 34)

I'm working on a project developed with Cocos2d-x. Using org.cocos2dx.lib, I have successfully ported it to Android in Android Studio. However, I'm encountering a crash issue that only occurs on ...
박치수's user avatar
0 votes
0 answers
49 views

Java native method implementation problem [duplicate]

Following is the Java code: // Java Program to Illustrate Native Keyword // Inside DLL named: NameOfDLLFile // Main class // NativeDemo // Java Program to Illustrate Native Keyword class ...
political science's user avatar
-1 votes
1 answer
159 views

Android App using C++ for serial USB access

I'm developing an Android application that needs to access a third-party library written in C that accesses the serial port through the command (*pSerialHandle) = open(deviceName, O_RDWR | O_NOCTTY | ...
Joterito's user avatar
  • 151
-1 votes
1 answer
147 views

JNI CallStaticObjectMethod is causing crash with Java 21

The company I work for recently moved to Java 21 from Java 8, which updated the JNI version as well that is used with interoperatibility with C++. All the function (written in C++) called through JNI ...
Stew's user avatar
  • 356
0 votes
1 answer
83 views

How to kill android application from c++

I am developing a library to detect rooted environment & I am able to achieve that goal but since the tools like frida, lsposed etc exists, An attacker can be easily able to hook libc's function ...
Ghost's user avatar
  • 102
0 votes
0 answers
27 views

No implementation found for Int when i use .so file android

I want to use .so file, i've success to load the library but the function is not working. Below is the code Structure MainActivity.java JniLoader.java package com.example.testapps; public class ...
Eko Muhammad Rilo Pembudi's user avatar
1 vote
1 answer
169 views

Make a shared library self-contained (pre-link dependencies of a shared library into it, recursively)?

I want to package a native shared library into a Java application (so it becomes part of the JAR), to be called via JNI. The shared library (Linux) comes from a 3rd party and has some dependencies, ...
Christian Fuchs's user avatar
3 votes
1 answer
119 views

Enums in JNI GetMethodID signature parameter list

So, this is an edge case that no amount of Googling seems to unearth. I have an enum in Kotlin; package myapp public enum State { STATE_SUCCEEDED, STATE_FROZEN, STATE_WAITING, ...
Lee Sylvester's user avatar
3 votes
1 answer
57 views

Convert a char* to a jByteArray or do a Latin1 to UFT8 conversion

In order to transfer data from a PLC to my application, I have a C/C++ API from the PLC manufacturer. Since my application is written in Java I use SWIG to get access to the API. This is an extract of ...
cProgrammer1992's user avatar
-2 votes
1 answer
152 views

How can jni be leveraged for an abstract class?

I am just getting familiar with jni/java and the workflow where we want to invoke methods that are written in native code but what i am unable to understand yet is how JNI can be leveraged if the ...
bourne's user avatar
  • 1,217
-1 votes
1 answer
38 views

How to set SWIG generated java proxy class as final

I am using SWIG to generate a Java wrapper for some C code. This C code has a structure that SWIG represents with the below Java proxy class. As one can see, this class can be extended given that it ...
user18371559's user avatar
0 votes
1 answer
54 views

How do you access images at a URL from within the JNI?

I am working on a project that involves matching images on an android phone using local resources. A general overview of the workflow is to take a camera image, generate a locality sensitive hash for ...
Jeremiah's user avatar
  • 101
0 votes
1 answer
95 views

Invoking Java Methods from C++, class not found

I was experimenting with how to invoke the Methods from C++, I got this far: #include <jni.h> #include <iostream> // Function to create the JVM and call the sayHi method void ...
Joseph's user avatar
  • 73
0 votes
1 answer
238 views

Android, How to call java function from Rust?

I have a Rust library that I compile as a static library for Android. I already have normal calls working. However, I would like to use the Keystore classes to securely store data from Rust using the ...
Oscar Franco's user avatar
  • 6,210
1 vote
1 answer
127 views

Why are native shared dependencies unavailable on the target but in its apk?

I want to ship native shared libraries with my apk. I added these shared libraries to the folder src/main/jniLibs/arm64-v8a. The compiled apk does include these libraries. I did verify this by ...
fabian's user avatar
  • 1,799
0 votes
1 answer
177 views

Android Native library file not found at runtim

I'm building a VPN app (using v2ray protocol) for school project and I am trying to use this (https://github.com/dev7dev/V2ray-Android) library and everything works fine if I just build the provided ...
KryptosR's user avatar
1 vote
0 answers
129 views

JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0x80

JNI method NewStringUTF expects input as a modified UTF8 string, the difference between Standard UTF-8 and modified UTF-8 is in how it handles the null (U+0000) character. In standard UTF-8, the null ...
Jatin guglani's user avatar
2 votes
1 answer
320 views

How to represent C++ class in java to be used via FFI?

I have following sample code in C++ class SomeClass: public ISomeClass { private: int myMember; public: SomeClass(int value) : myMember(value) {} __declspec(dllexport) int GetCount() ...
Bojan Vukasovic's user avatar
0 votes
0 answers
121 views

React Native Javascript Native Interface (JSI) Linking failure on Android

I'm trying to get a JavaScript Native Interface module working on Android. Can anyone help? I can compile the app including the CPP library. The app opens, runs the MyJsiNamespace::...
Adonis Gaitatzis's user avatar
-1 votes
1 answer
34 views

Howto create h-files with stable names using javac

I've got a Java class which starts with package examples.logging; public class FastLogging { // Logging class public static native long logging_new(int level, String domain, boolean console,...
Martin Bammer's user avatar
-1 votes
1 answer
115 views

Why No implementation found for boolean android.util.Log.isLoggable on android14?

I'm trying to load my apk from JNI when zygote start. Encounter error No implementation found for boolean android.util.Log.isLoggable on android14 but it is works well on android 13. I found it load ...
Nelson's user avatar
  • 181
0 votes
0 answers
47 views

How to add native methods in JDK8 source code?

I want to add a new native method called "JVM_NewAllocGen" and use it through "System.newAllocGen()". I have added code as below: path-to-jdk8/hotspot/src/share/vm/prims/jvm.cpp: ...
ggssh's user avatar
  • 1

1
2 3 4 5
196