jni.h Implementation

148 views
Skip to first unread message

Claudio Rizzo

unread,
Apr 8, 2019, 11:23:55 AM4/8/19
to android-ndk
Dear all,

For a project I am working on, I need the c/cpp implementation of the jni.h header. I looked around quite a bit, but I failed in finding it. Can anyone help me finding it? I assumed it has to be in the NDK source code somewhere, is that the case?.

chung...@yahoo.com

unread,
Apr 8, 2019, 11:34:42 AM4/8/19
to andro...@googlegroups.com

What are you working on? Did you look at it being a different package that you have to download separately from the ndk? jni use to be part of the jkd but later it was separated as a different package.

On Monday, April 8, 2019, 3:23:48 PM UTC, Claudio Rizzo <claudio....@gmail.com> wrote:


Dear all,

For a project I am working on, I need the c/cpp implementation of the jni.h header. I looked around quite a bit, but I failed in finding it. Can anyone help me finding it? I assumed it has to be in the NDK source code somewhere, is that the case?.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/741e3727-65c7-4307-94e8-c53529cfd26d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Claudio Rizzo

unread,
Apr 8, 2019, 2:23:39 PM4/8/19
to android-ndk
I am creating a testing environment which extract a native function from an apk and try to execute it as standalone. For this I need a Mock version of JNIEnv which would allow the execution of the function. 
However, despite I do not necessarily need the whole Environment (not all the functions are always used), in many samples I have there is a need for more and more functions to implements.

I have looked in the JDK but all I can really find is the jni.h header but not the implementation of its interfaces. I looked around different packages but with no success. Do you have any package you would recommend looking into?


On Monday, 8 April 2019 16:34:42 UTC+1, ageslome wrote:

What are you working on? Did you look at it being a different package that you have to download separately from the ndk? jni use to be part of the jkd but later it was separated as a different package.

On Monday, April 8, 2019, 3:23:48 PM UTC, Claudio Rizzo <claudio...@gmail.com> wrote:


Dear all,

For a project I am working on, I need the c/cpp implementation of the jni.h header. I looked around quite a bit, but I failed in finding it. Can anyone help me finding it? I assumed it has to be in the NDK source code somewhere, is that the case?.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.

Dan Albert

unread,
Apr 8, 2019, 3:30:21 PM4/8/19
to android-ndk
ART is the implementation for jni.h. You can't trivially stub that. Even if you did, testing specifically the JNI features of your code against the wrong implementation won't be very useful testing.

If you're just trying to test your native code, do so independently of testing the JNI interaction layer. Test your native code with something like GTest as standalone unit tests, and test the JNI interaction in the real JNI environment (as part of an APK, running in ART). You can also use https://github.com/DanAlbert/GTestJNI to use GTest for your native code when running inside the Zygote.

To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.

Claudio Rizzo

unread,
Apr 8, 2019, 7:08:37 PM4/8/19
to android-ndk
First of all thanks for your help, but I should probably give a bit more context.

I am writing a fuzzer for native methods, of which I do **not** have any source code, and I just need to check the JNIEnv implementation to help me understand how to write my stubs in the best way possible.

I successfully fuzzed some native methods, but for others I need more JNIEnv functions implemented.

What do you mean that ART is the implementation of jni.h?

mic _

unread,
Apr 9, 2019, 5:14:29 AM4/9/19
to andro...@googlegroups.com
>What do you mean that ART is the implementation of jni.h? 

jni.h specifies the interface, and ART (or formerly, Dalvik) provides the implementation.


/Michael  

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
Reply all
Reply to author
Forward
0 new messages