Can I get a list of methods for a class with JNI?

I’m interfacing with the Android SDK and currently trying to call MediaCodec.getInputBuffer(int). I’m getting an error that the method/signature doesn’t exist though;

AndroidJavaObject InputByteBuffer = Codec.Call<AndroidJavaObject> ("getInputBuffer", BufferIndex);

My Codec class is fine (dequeBufferIndex gave me a valid index), but when I execute this line I get

java.lang.NoSuchMethodError: no methid with name='getInputBuffer' signature='(i)Ljava/lang/Object;' in class Landoird/media/MediaCodec;

So, I’m presuming this function exists, but maybe I need to re-interpret ByteBuffer as a different type?.. or perhaps call it manually with an explicit signature…

So what would really help is a way of seeing all the methods on a Java class… isthis possible?

Unity nor JNI provides any reflection interface. However, Java itself has reflection support. Though using Javas’ reflection via JNI would probably be a pain. Also using reflection most likely wouldn’t tell you more than the Android API documentaion can tell you. So getInputBuffer does exist and the signature should be:


I don’t know why your signature has a lowercase “i” as parameter type. I’m not even sure if it makes a difference. What type has your BufferIndex variable? Unity’s JNI wrapper detects and generates the signature based on what you pass to the method.

Revisiting my own answer… don’t forget

cd $ANDROID_HOME/platforms/android-19

first, otherwise it won’t find any classes