java-native-interface Questions

3

Solved

I'm trying to call a java method from native C code in an Android Application. This sounds quite simple with the usage of JNI, but my code always crashes when finally calling the method itself. Her...
Unreflective asked 23/9, 2011 at 14:44

3

Solved

Is it possible to add a new path for native libraries at runtime ?. (Instead of starting Java with the property java.library.path), so a call to System.loadLibrary(nativeLibraryName) will include ...
Hydrothermal asked 14/3, 2013 at 12:23

9

Solved

I am tracking down crashes with our Android application (which uses the NDK to load a custom C++ library) using a crash reporting service. A small number of users are experiencing the following cra...
Sheathe asked 20/2, 2015 at 21:48

7

Solved

Is it possible to initialize Java system properties using some sort of configuration file? (ie: can you set java.library.path using a file inside your jar) EDIT: Clarification: I am asking sp...
Babylonian asked 18/7, 2011 at 16:36

2

Solved

I am trying to compile the following code: https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/master into an apk file. To do this, I created a default Android project wi...
Philipps asked 27/8, 2018 at 20:48

2

Solved

I have a .aar including some native .so. Andrid project B implements this .aar like: dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation(name: 'abcd', ext:'aar...
Cerargyrite asked 24/5, 2021 at 13:6

4

Solved

All I'm trying to do is generate a JNI Header file using JDK Javah.exe program, but no matter what I try I keep getting the error message "Error: could not find class file for 'ddg.ndkTest.NativeLi...
Devine asked 3/7, 2012 at 14:22

3

Solved

I'm developing an Android application that relies on FFmpeg to retrieve audio metadata. I know it's possible to retrieve album art programmatically using FFMpeg. However, once you have decoded the ...
Ljoka asked 27/11, 2012 at 20:44

2

Solved

I have an android_library.aar file that containing library.so and some other resources and java files. I imported android_library.aar to my project. My project uses c++ code with NDK. My problem i...
Argue asked 20/8, 2018 at 12:31

12

Solved

In Ubuntu 12.04, I have jdk7 from sun/oracle installed. When locate jni.h, it prints multiple locations /usr/lib/jvm/java-6-openjdk-amd64/include/jni.h /usr/lib/jvm/jdk1.7.0_07/include/jni.h ... ...
Biomedicine asked 25/1, 2013 at 20:19

2

Solved

Background: I've decided that since bitmaps take a lot of memory which can cause out-of-memory errors easily, I will put the hard, memory consuming work on C/C++ code . The steps I use for rotat...
Thermodynamics asked 18/1, 2013 at 12:10

4

Solved

I'm trying to use someone else's Makefile to complile a very simple c++ library. The makefile is as follows: JNIFLAGS=-O2 -pthread -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/inclu...
Frontpage asked 18/1, 2010 at 12:49

4

Solved

JAVA Code boolean b = invokeNativeFunction(); int i = invokeNativeFunction2(); C code jboolean Java_com_any_dom_Eservice_invokeNativeFunction(JNIEnv* env, jobject obj) { bool bb = 0; ... ret...
Museology asked 13/1, 2015 at 15:6

8

Solved

At the moment, i'm trying to create a Java-application which uses CUDA-functionality. The connection between CUDA and Java works fine, but i've got another problem and wanted to ask, if my thoughts...
Guaranty asked 27/10, 2009 at 17:22

5

Desired output examples: (Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node; (Ljava/lang/String;)Lorg/w3c/dom/Attr; Such signatures can be generated using javap utility: javap -s -p org.w3c.dom.Node But i...
Claytor asked 16/12, 2010 at 2:11

5

I am working on a Java application for solving a class of numerical optimization problems - large-scale linear programming problems to be more precise. A single problem can be split up into smaller...
Retrospection asked 14/11, 2019 at 20:29

2

Solved

I have an Android app that uses some JNI code. Long story short (pun intended), it is nearly impossible to convert the JNI libraries to 64-bit as it would require a lot of changes. The code (both J...
Declare asked 16/5, 2016 at 4:38

2

Solved

I'm having some trouble with native code using JNI and I suspect that this is maybe due to a call to setRequestedOrientation(). What happens to the activity when I call setRequestedOrientation()? ...
Helban asked 16/10, 2015 at 14:38

3

Solved

In my AndroidStudio project I created native library using JNI with CMake and CPP code. Everything builds and runs OK, but when I try to commit and push my code to git, the CodeAnalysis appears in ...
Footslog asked 24/1, 2022 at 20:27

42

Solved

Consider: public class LoginCumReg implements ActionListener, KeyListener { private JFrame form; private JTextField txtunm; private JTextField txtnm; private JTextField txteml; private JButto...
Devolution asked 13/3, 2014 at 14:9

2

Solved

So, I'm attempting to call the Linux C - stat function. My JNA code: public int stat(bap path, bap statdump); the bap class: public static class bap extends Structure { public byte[] arr...
Shroud asked 25/4, 2015 at 3:10

4

Solved

Like the title says - how to add native code to existing Android Studio project, without breaking the current project, including gradle and proguard settings?
Colorless asked 15/7, 2017 at 12:22

11

Solved

I'm using Opencv sdk for Android to develop a real time processing and matching. The main Opencv traitment logic is in a JNI function. The problem is that sometimes (just sometimes) my app crashe...

16

Solved

What is wrong with my make file? Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_SRC_FILES := foo.c LOCAL_EXPORT_LDLIBS := -llog include $(BUILD_SHARED_LI...
Missioner asked 15/12, 2010 at 23:15

5

Solved

Now i create a new project include c++ support in Android Studio 3.2, it has native-lib.cpp naturally, the CMakeLists.txt looks like this: add_library( # Sets the name of the library. native-lib ...

© 2022 - 2025 — McMap. All rights reserved.