9,801 questions
3
votes
1
answer
97
views
Create a RawPacket with a byte array
I'm creating an Android app that can capture the internet traffic to analyze later. Through a VPN tunnel, I can get the packets in a byte[] array.
Is it possible to create a pcpp::RawPacket in ...
1
vote
0
answers
324
views
How do I call Java code from C in a plugin and avoid random fails
Then my plugin, written in C, is loaded it makes an initial call to JNI_CreateJavaVM(). It seems to fail completely at random. Running it one time might fail but the next time it might succeed. It ...
4
votes
2
answers
213
views
How to load native libraries with a long path?
My Java application is installed to another application's "test area", resulting in longer absolute file paths than usual.
I can load native libraries from a short file path:
System.load(&...
5
votes
1
answer
74
views
Lookup for a constant from a native library
I'm writing a demo Java app that interacts with libpq. For this, I'm using java.lang.foreing package. My problem is, I can easily pick up functions but not integer enum constants:
System.load("...
0
votes
0
answers
46
views
Qt 6 Android: Camera intent opens but image is not saved to device when using FileProvider
I am developing an Android application using Qt 6 (C++) and trying to open the system camera and save the captured image to device storage.
The camera app opens correctly, the photo is taken, but the ...
0
votes
0
answers
119
views
SIGABRT in libfbjni.so: facebook::jni::JNativeRunnable::run() crash on arm64-v8a (React Native)
I’m seeing a native crash (SIGABRT) on arm64-v8a devices in a React Native Android app on Android 15 and 16. The crash originates from libfbjni.so while executing facebook::jni::JNativeRunnable::run()....
0
votes
0
answers
65
views
React Native Android: BLE audio packets received but no continuous live sound using AudioTrack + JNI (.so SDK)
I am building a React Native (Android) application that connects to a Bluetooth LE fetal doppler device.
The BLE connection works correctly and I receive live packets (0x71 command) that contain audio ...
0
votes
0
answers
79
views
Portaudio is recording a weird distorted waveform when recording jack devices and firefox
I am not sure why this is happening so I am coming here to look for any sort of help I can get. Basically when recording any jack device such as firefox in my app it comes out as distorted. But it ...
3
votes
0
answers
159
views
Memory leak in JNI with AttachCurrentThread() and DetachCurrentThread()
I have a Java application that calls a native function. That native function contains a loop, and in each iteration it launches 10 threads and waits for them to complete. Each thread performs a number ...
6
votes
0
answers
473
views
When should I use name resolution vs. RegisterNatives in JNI?
In System.c, the JVM function corresponding to Java’s System.currentTimeMillis() is registered using RegisterNatives.
In contrast, System.identityHashCode(Object) calls a JVM function directly based ...
0
votes
1
answer
79
views
AWS Kinesis Video Streams Producer JNI times out (StatusCode: 0xf) in Ubuntu container running gRPC service; REST container works
gRPC service consistently fails with KVS Producer JNI “producer stream creation time out StatusCode: 0xf” about ~15s after “Creating Kinesis Video stream”.
REST service (same repo, same JNI .so, same ...
3
votes
1
answer
145
views
What is a .so file in Java projects, and how can I use an old JAR that depends on .so files in Spring Boot?
I have an old Java JAR file that depends on .so files (shared object libraries).
I understand .so files are native libraries (written in C/C++), and the JAR uses JNI (Java Native Interface) or JNA to ...
0
votes
0
answers
81
views
Link third party C library through the JNI
I'm trying to add the wasmtime c-api library to my app. But I'm getting the following error at runtime:
java.lang.UnsatisfiedLinkError: dlopen failed: library "/Users/tufekoi/Repos/...
0
votes
0
answers
24
views
LOCAL_MODULE_FILENAME must not contain a file extension (Implementing GStreamer in Andriod Studio Project)
I am trying to integrate GStreamer via JNI into an existing Android Studio project.
My Android.mk file looks like this:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := rtsp-...
0
votes
0
answers
104
views
How to get Cronet Android headers to use with cronet.so in JNI (C++)?
I'm trying to use Cronet on Android directly from my JNI / C++ layer, not through the Java API.
I already have the cronet.so (from Play Services / build output).
What I'm missing are the headers (like ...
2
votes
2
answers
576
views
Find out which third party library includes specific native library
I have a very large Android project with hundreds of 3rd party libraries.
Some of those libraries have native .so libs inside then. I can see all .so files using Android Studio -> Analyze Apk... ...
0
votes
0
answers
102
views
How to get information from a QR Code with Unreal Engine Android
I have very little experience with c++ or java and I want to make an Android app with Unreal Engine 5.3, which can either scan or be opened by scanning a QR Code and do something with the Information ...
0
votes
0
answers
153
views
Java to C++ JNI DLL error - java.lang.UnsatisfiedLinkError: ... Can't find dependent libraries
Edit to describe the solution: during development, I was making changes to my path. If running java in a command prompt window, then that window must be closed and a new one opened to reflect changes ...
0
votes
0
answers
117
views
JNI is not working correctly in flutter:ffi
I'm trying to call the function through the environment variable env, namely env->FindClass("android/os/BatteryManager"), but eventually the error
F/libc (27883): Fatal signal 11 (...
3
votes
3
answers
202
views
How to handle EINTR in connect()?
I'm trying to handle EINTR error from POSIX connect call. I'm running on OSX this connect code:
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_connect
(JNIEnv *e, jclass cl, jint fd, jlong ...
2
votes
1
answer
143
views
Does the JNI provide direct access to _Atomic values for the respective Java Atomic classes?
When working with JNI, can the native side obtain an _Atomic int32_t* given a Java AtomicInteger reference, and run C atomic functions on it (e.g. atomic_fetch_add)?
We could call Java's methods (e.g. ...
0
votes
0
answers
79
views
Instantiate a class from within apk package then call a Java function from it using unidbg?
I use the following statement in unidbg to resolve a class from within an apk package:
SampleClass = vm.resolveClass("path/to/class");
Then, I use the SampleClass.callStaticJniMethodObject() ...
0
votes
0
answers
80
views
ClassNotFoundException when calling custom Java class from Qt for Android using JNI
I'm developing an Android app using Qt 6.9 that needs to scan WiFi networks. I've created a custom Java class to handle the WiFi scanning, but when I try to call it from C++ using QJniObject, I get a ...
0
votes
1
answer
151
views
Using JNI library (libnfc) to use PN532 reader in the android application. Cannot build a 32-bit shared library for the purpose of running in Emulator
As mentioned above, I am using the PN532 reader to connect it with the application.
Using the 'libnfc' as JNI library, I built the pn532_uart library as a shared library for 'Arm' based to use the ...
0
votes
1
answer
68
views
CMake is using JNI headers in `/user/local/include` and not the ones at $JAVA_HOME
CMake is using JNI headers in /user/local/include and not the ones at $JAVA_HOME
CMAKE File
cmake_minimum_required(VERSION 3.24.0...3.31.1)
cmake_policy(SET CMP0135 NEW)
set(...
0
votes
0
answers
89
views
UnsatisfiedLinkError: dlopen failed: library "lib**.so" not found on various Android devices
I'm encountering a strange issue with my Android application. I'm receiving crash reports from the Play Console with the following error:
Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed:...
0
votes
1
answer
206
views
What does it mean when an Android app has a transactNative DeadObjectException?
My app is a game that consumes a native.so file and has a JNI layer. Whenever the OS kills my app (for example during an in-app update), I see this warning in logcat. What does it mean and how can I ...
0
votes
1
answer
100
views
How do I get a Java field using the Rust jni crate?
I am using the Rust jni crate, and currently have a native method defined. I am trying to figure out how I get a java field, which is a different class that I have also made, and interact with it ...
0
votes
0
answers
56
views
No implementation found for boolean android.util.Log.isLoggable after JNI_CreateJavaVM
I'm try to exec Log.isLoggable after JNI_CreateJavaVM. Got the error as below with Android 14 and above.
01-02 11:35:15.704 24244 24244 F zygote64: runtime.cc:707] Pending exception java.lang....
4
votes
2
answers
755
views
Calling a Java function from C using Foreign Function & Memory API
All examples I've come across for calling a Java method from C using the Foreign Function & Memory API involve callbacks, that is, a Java method that runs some native function with a Java callback ...
3
votes
1
answer
193
views
Returning multiple values (Pair) from Rust to Android through JNI
I have an Android app (written in Kotlin), with the processing code running in Rust. I'm using JNI (Java Native Interface) as communication layer.
Goal
I can successfully return a bool, but I want to ...
2
votes
0
answers
84
views
UnsatisfiedLinkError for Go native method with custom Java return type
I have a Go method that returns 2 byte arrays and 2 strings defined as:
// export GetDetails
func GetDetails() (unsafe.Pointer, unsafe.Pointer, *C.char, *C.char) {
...
return C.CBytes(arr1), C....
0
votes
1
answer
87
views
Android (Kotlin / Java) List<String> / Array<String> --> Rust Vec<String> conversion using JNI
I have an Android app (written in Kotlin), with the processing code running in Rust. I'm trying to send List<String> data to the Rust back-end and interpret it as a Vec<String>. The size ...
1
vote
0
answers
38
views
How to properly call static method in java from jni [duplicate]
I am trying to pass some initialization values from jni to java.
I have been able locate and correctly call the java method from my JNILib Init function but when I try to call it from a different ...
2
votes
1
answer
144
views
Javaw.exe - Console Window Randomly Appearing
I have a graphical JavaFX application that is launching a secondary child process using Javaw.exe. Javaw.exe is chosen because I do not want a console window to be visible. After a short amount of ...
-1
votes
1
answer
149
views
Using Java FX and C++ together with JNA/JNI [closed]
I'm working on a class project and about half of our group knows c++ and the other half only knows Java FX. Our project is a synthesizer, which involves a good amount of DSP and GUI stuff. I figured ...
1
vote
0
answers
86
views
Linux JNI library not finding a symbol in another loaded native library
Running a Java program on a raspberry Pi 5.0 (64bit) under Open-JDK-17. I'm trying to get Bluetooth working (64bit) with the bluecove Java API. One of my shared libs libbluecove_aarch64.so does not ...
0
votes
0
answers
232
views
Android NDK "wrap.sh" and using sanitizers
For some time I am trying to solve a bug in our native C++ shared library using traces but it is not easily reproducable (multithreading/networking involved). We have Android (Java) code instantiating ...
0
votes
1
answer
174
views
"Unknown option -jar" on running a Rust-Java JNI GTK4 application [closed]
Recently, I have been working on a small gui app that uses GTK4. This gui app uses a combination of Java and Rust (I am using the jni crate for interop).
I am creating the Gui window using the Gtk-rs ...
0
votes
1
answer
55
views
fmod crashes in Android java_object == null
I am using fmod library in my Android app to filter sound. There is a crash in GP console and I can't reproduce it on my device. Here is the backtrace:
JNI DETECTED ERROR IN APPLICATION: java_object ==...
13
votes
2
answers
312
views
Is this a bug in the JVM, or in NASM?
I think I've found a bug, but I'm not sure whether to blame the JVM, JNI, NASM, GCC, or ld.
The bug causes my compiled modding language called grug (see this for videos and explanations) to ...
4
votes
1
answer
324
views
How do I catch SIGSEGV, SIGALRM, and SIGFPE with sigaction() when using JNI?
My goal is to catch SIGSEGV (infinite recursion), SIGALRM (infinite loops, raised by a timer), and SIGFPE (division by 0) from native code, since I want to prevent Minecraft (Java) from crashing or ...
0
votes
0
answers
47
views
Impact on ART due to process termination from exception
I'm working on an Android app consisting of Kotlin (for the UI/UX) and C++ (app logic). I'm using JNI to bridge C++ to Kotlin. When a new thread is created, AttachCurrentThread is invoked to attach ...
1
vote
0
answers
73
views
How do I make jni run a C program?
I have a program in jni (java native interface), which should display the text "hello world" in C
#include "MyJavaClass.h"
#include <jni.h>
#include <stdio.h>
// ...
0
votes
1
answer
97
views
Is there a way to ensure System.loadLibrary loads dependent DLLs from the same directory as the primary loaded DLL
I am working in Java on Windows OS. I’m using System.loadLibrary to load called A.dll, which exposes some JNI functions. A.dll depends on B.dll. I put A.dll and B.dll on a repo, told my colleague to ...
0
votes
1
answer
127
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 ...
1
vote
0
answers
84
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] = "...
1
vote
1
answer
141
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.
...
1
vote
1
answer
116
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 ...
0
votes
0
answers
66
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 ...