I am trying to compile my jnicode it showing error
_JNIEnv::GetShortArrayElements(JNIEnv*&, _jshortArray*&, int)'
my code is:
extern "C" JNIEXPORT jint Java_com_techgentsia_sound_Opusmain_nativeDecodeBytes (JNIEnv *env, jobject thiz,jbyteArray decoder_insrc,jshortArray decoder_out)
{
int frame_size=320;
jshort* pcm_data_decoder=env->GetShortArrayElements(env, decoder_out,0);
jbyte* opus_data_decoder=env->GetByteArrayElements(env, decoder_insrc,0);
}
the error in compiler is:
/home/clifford/opusbuild/jni/opus/com_techgentsia_sound_Opusmain.cpp:117:72: error: no matching function for call to '_JNIEnv::GetShortArrayElements(JNIEnv*&, _jshortArray*&, int)'
/home/clifford/opusbuild/jni/opus/com_techgentsia_sound_Opusmain.cpp:117:72: note: candidate is:
/home/clifford/apps/android-ndk-r10/platforms/android-9/arch-arm/usr/include /jni.h:921:13: note: jshort* _JNIEnv::GetShortArrayElements(jshortArray, jboolean*)
/home/clifford/apps/android-ndk-r10/platforms/android-9/arch-arm/usr/include/jni.h:921:13: note: candidate expects 2 arguments, 3 provided
i solved the problem change the code as below.
{ int frame_size=320;
}
we don'need to pass env in this methods GetShortArrayElements( decoder_out,0); GetByteArrayElements( decoder_insrc,0);
because i am writing cpp class