9,801 questions
0
votes
0
answers
95
views
Calling Java from C using FFM [duplicate]
I've recently come across FFM as an alternative to JNI for Java-to-C communication. However, I'm struggling with it.
Calling C from Java seems straightforward (downcalling). However, calling Java ...
0
votes
0
answers
56
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 ...
0
votes
0
answers
69
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
63
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 ...
0
votes
0
answers
77
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
102
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 (...
2
votes
1
answer
135
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
63
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
57
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
1
answer
83
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
0
answers
43
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
522
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 ...
2
votes
0
answers
78
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....
1
vote
0
answers
36
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 ...
-1
votes
1
answer
138
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 ...
0
votes
0
answers
159
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
49
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 ==...
4
votes
1
answer
264
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
66
views
Call IterateOverInstancesOfClass getting stuck
I'm trying to call JVMTI->IterateOverInstancesOfClass from JNI (like here) but the call is getting stuck.
I aim to find an instance of a specific class to call a non-static method.
I saw this ...
0
votes
1
answer
79
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 ...
1
vote
0
answers
70
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
93
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 ...
1
vote
1
answer
73
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 ...
-1
votes
1
answer
192
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 ...
0
votes
1
answer
240
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 ...