的UnsatisfiedLinkError AudioRecordNew [英] UnsatisfiedLinkError AudioRecordNew
问题描述
尝试使用code从的此处
我试着让我结束了ULAW音频数据的InputStream合并这两个类。所以我editted UlawEn coderInputStream像这样:
私人MicrophoneInputStream MICIN;
公共UlawEn coderInputStream(){
MMAX = 0;
尝试{
MICIN =新MicrophoneInputStream(8000,1); }赶上(IOException异常五){
// TODO自动生成catch块
e.printStackTrace();
}
}
然后尝试使用UlawEn coderInputStream:
而(transmittingAudio){
如果(micInStream.available()大于0){
//字节[]数据=新的字节[audioDump.available()];
INT读取动作= micInStream.read(数据);
os.write(数据,0,读取动作);
os.flush();
// ca.transmitAxisAudioPacket(数据);
//的System.out.println(读+读取动作);
}
但是似乎有与MicrophoneInputStream底部JNI本地语句的一个问题。
私有静态本地INT AudioRecordNew(INT采样率,诠释fifoDepth);
这个错误:
14 05-14:46:48.544:W / dalvikvm(28658):未找到实现
本地LCOM / avispl / NICU /音频/ MicrophoneInputStream; .AudioRecordNew
(二)我
14 05-14:46:48.552:W / dalvikvm(28658):主题ID = 10:线程退出
与未捕获的异常(组= 0x40018560)
14 05-14:46:48.552:E / AndroidRuntime(28658):致命异常:
螺纹12
14 05-14:46:48.552:E / AndroidRuntime(28658):
java.lang.UnsatisfiedLinkError中:AudioRecordNew
14 05-14:46:48.552:E / AndroidRuntime(28658):在
com.avispl.nicu.audio.MicrophoneInputStream.AudioRecordNew(母语
法)
14 05-14:46:48.552:E / AndroidRuntime(28658):在
com.avispl.nicu.audio.MicrophoneInputStream(MicrophoneInputStream.java:27)
14 05-14:46:48.552:E / AndroidRuntime(28658):在
com.avispl.nicu.audio.UlawEn coderInputStream(UlawEn coderInputStream.java:111)。
14 05-14:46:48.552:E / AndroidRuntime(28658):在
com.avispl.nicu.audio.AudioTransmitter.run(AudioTransmitter.java:66)
块引用>解决方案请问,如果这是远远低于你的问题问的水平,我累了,我发现你的问题很难理解:
如果你试图调用本地方法
AudioRecordNew
您需要做
静态{的System.loadLibrary(cLibraryName); }
加载您构建使用本机库Android的NDK
\\Android.mk
\\Application.mk
和您的
C ++
文件(^ h
文件),将需要像这样的方法:JNIEXPORT无效JNICALL Java_com_company_package_JavaFile_AudioRecordNew(JNIEnv的* ENV,jobject OBJ,jint为arg0,ARG1 jint)
{}除非你有做上述所有的机库,你会得到一个错误,告诉你本机库不存在。 (它看起来像你有问题就在这里,你不必在本例中使用的Java本机库)。
如果你能得到源$ C $ C的机库,但是你可以按照上面的建库的Android版本,并保持下去。
Trying to use code from here Im trying to incorporate both classes so that I end up with an inputStream of ulaw audio data. So I have editted UlawEncoderInputStream like so:
private MicrophoneInputStream micIn; public UlawEncoderInputStream() { mMax = 0; try { micIn = new MicrophoneInputStream(8000, 1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Then attempt to use that UlawEncoderInputStream:
while(transmittingAudio) { if(micInStream.available()>0) { // byte[] data = new byte[audioDump.available()]; int bytesRead = micInStream.read(data); os.write(data,0,bytesRead); os.flush(); // ca.transmitAxisAudioPacket(data); // System.out.println("read "+bytesRead); }
However there seems to be a problem with the JNI native statement at the bottom of MicrophoneInputStream.
private static native int AudioRecordNew(int sampleRate, int fifoDepth);
Errors with this:
05-14 14:46:48.544: W/dalvikvm(28658): No implementation found for native Lcom/avispl/nicu/audio/MicrophoneInputStream;.AudioRecordNew (II)I
05-14 14:46:48.552: W/dalvikvm(28658): threadid=10: thread exiting with uncaught exception (group=0x40018560)
05-14 14:46:48.552: E/AndroidRuntime(28658): FATAL EXCEPTION: Thread-12
05-14 14:46:48.552: E/AndroidRuntime(28658): java.lang.UnsatisfiedLinkError: AudioRecordNew
05-14 14:46:48.552: E/AndroidRuntime(28658): at com.avispl.nicu.audio.MicrophoneInputStream.AudioRecordNew(Native Method)
05-14 14:46:48.552: E/AndroidRuntime(28658): at com.avispl.nicu.audio.MicrophoneInputStream.(MicrophoneInputStream.java:27)
05-14 14:46:48.552: E/AndroidRuntime(28658): at com.avispl.nicu.audio.UlawEncoderInputStream.(UlawEncoderInputStream.java:111)
05-14 14:46:48.552: E/AndroidRuntime(28658): at com.avispl.nicu.audio.AudioTransmitter.run(AudioTransmitter.java:66)
解决方案Excuse me if this is far below the level of the question your asking, I'm tired and I'm finding your question hard to understand:
If you are trying to call the native method
AudioRecordNew
You will need to do a
static { System.loadLibrary("cLibraryName"); }
to load the native library you construct usingandroid-ndk
\Android.mk
\Application.mk
and your
c++
file (andh
file) will need a method like so:JNIEXPORT void JNICALL Java_com_company_package_JavaFile_AudioRecordNew(JNIEnv* env, jobject obj, jint arg0, jint arg1) { }
Unless you have a native library which does all of the above, you'll get an error telling you the native library doesn't exist. (Which looks like the problem you have here, you don't have the java native library used in the example).
If you can get the source code for the native library however you can follow the above to build an android version of the library and keep going.
这篇关于的UnsatisfiedLinkError AudioRecordNew的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!