android ndk . lang。如果:nativeStart

时间:2023-01-21 15:47:59

For playing AAC file i have setup NDK and downloaded http://code.google.com/p/aacplayer-android/ code

为了播放AAC文件,我安装了NDK并下载了http://code.google.com/p/aacplayer-android/ code

that source i have downloaded from

我从那里下载的资料

 svn checkout http://aacplayer-android.googlecode.com/svn/trunk/ aacplayer-android-read-only

after that i have downloaded player from following code

然后我从下面的代码下载播放器

http://aacplayer-android.googlecode.com/files/aacplayer-android-r25.zip

http://aacplayer-android.googlecode.com/files/aacplayer-android-r25.zip

now i have to use that code into my project so i have create new JNI folder and copy all the code .c and .h file... below is an image

现在我必须在我的项目中使用这些代码,所以我创建了新的JNI文件夹,并将所有的代码.c和.h文件…下面是一个图像

android ndk . lang。如果:nativeStart

Then i have run ndk-build command and generated .so files which is looking like below

然后运行ndk-build命令并生成。so文件,如下所示

android ndk . lang。如果:nativeStart

Now u can see that this two folder in libs folder and with .so files are created which is looking like below

现在你可以看到这两个文件夹在libs文件夹和。so文件被创建,如下所示

android ndk . lang。如果:nativeStart

Now when i build and run apps using below code every thing is working fine the library is loading with out any java.lang.UnsatisfiedLinkError: nativeStart error

现在,当我使用下面的代码构建和运行应用程序时,所有的东西都运行得很好。如果:nativeStart错误

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list);

    System.loadLibrary("aacarray"); 
    System.loadLibrary("mms");

but when i start to play streaming AAC file below error will generated

但当我开始播放流媒体AAC文件以下的错误将产生

      02-19 23:13:47.090: W/dalvikvm(847): No implementation found for native Lcom/example/xmlparsingex/ArrayDecoder;.nativeStart (ILcom/example/xmlparsingex/ArrayBufferReader;Lcom/example/xmlparsingex/Decoder$Info;)I
      02-19 23:13:47.100: W/dalvikvm(847): threadid=11: thread exiting with uncaught exception (group=0x40015560)
      02-19 23:13:47.100: E/AndroidRuntime(847): FATAL EXCEPTION: Thread-12
      02-19 23:13:47.100: E/AndroidRuntime(847): java.lang.UnsatisfiedLinkError: nativeStart
      02-19 23:13:47.100: E/AndroidRuntime(847):    at com.example.xmlparsingex.ArrayDecoder.nativeStart(Native Method)
      02-19 23:13:47.100: E/AndroidRuntime(847):    at com.example.xmlparsingex.ArrayDecoder.start(ArrayDecoder.java:100)
     02-19 23:13:47.100: E/AndroidRuntime(847):     at com.example.xmlparsingex.ArrayAACPlayer.playImpl(ArrayAACPlayer.java:114)
     02-19 23:13:47.100: E/AndroidRuntime(847):     at com.example.xmlparsingex.AACPlayer.play(AACPlayer.java:273)
     02-19 23:13:47.100: E/AndroidRuntime(847):     at com.example.xmlparsingex.AACPlayer.play(AACPlayer.java:242)
     02-19 23:13:47.100: E/AndroidRuntime(847):     at com.example.xmlparsingex.AACPlayer$1.run(AACPlayer.java:202)
     02-19 23:13:47.100: E/AndroidRuntime(847):     at java.lang.Thread.run(Thread.java:1019)

please note that i have posted this question which has same error java.lang.UnsatisfiedLinkError: nativeStart android NDK but this question is not same like this so please do not downvote :(

请注意,我已经发布了这个问题,它有相同的错误java.lang。UnsatisfiedLinkError: nativeStart android NDK,但这个问题跟这个问题不一样,所以请不要投反对票:(

i Have tried so much to solve the issue but could not success please any body can help me...

我已经尝试了很多来解决这个问题,但是没有成功,请任何一个人可以帮助我……

1 个解决方案

#1


3  

You took the aacplayer classes from original package com.spoledge.aacplayer and dropped them into your own package com.example.xmlparsingex (probably originated in some Android example). You can't do that. Pure Java classes will survive it (supported by Eclipse refactoring), but classes with native methods won't. Native methods are bound to specific function names in native library. If the native library libaacarray.so exports a function Java_com_spoledge_aacplayer_ArrayDecoder_nativeStart, then the corresponding java class must be com.spoledge.aacplayer.ArrayDecoder and there is no way around it. Unless you want to tweak and recompile the native library too.

您从最初的包com.spoledge中学到了aacplayer类。aacplayer,并将它们放入您自己的软件包com。xmlparsingex(可能源于一些Android示例)。你不能这样做。纯粹的Java类可以存活下来(由Eclipse重构支持),但是具有本地方法的类则不能。本机方法被绑定到本机库中的特定函数名。如果是本地库libaacarray。因此导出一个函数Java_com_spoledge_aacplayer_ArrayDecoder_nativeStart,那么相应的java类必须是com.spoledge.aacplayer。ArrayDecoder没有办法绕过它。除非您也想调整和重新编译本机库。

#1


3  

You took the aacplayer classes from original package com.spoledge.aacplayer and dropped them into your own package com.example.xmlparsingex (probably originated in some Android example). You can't do that. Pure Java classes will survive it (supported by Eclipse refactoring), but classes with native methods won't. Native methods are bound to specific function names in native library. If the native library libaacarray.so exports a function Java_com_spoledge_aacplayer_ArrayDecoder_nativeStart, then the corresponding java class must be com.spoledge.aacplayer.ArrayDecoder and there is no way around it. Unless you want to tweak and recompile the native library too.

您从最初的包com.spoledge中学到了aacplayer类。aacplayer,并将它们放入您自己的软件包com。xmlparsingex(可能源于一些Android示例)。你不能这样做。纯粹的Java类可以存活下来(由Eclipse重构支持),但是具有本地方法的类则不能。本机方法被绑定到本机库中的特定函数名。如果是本地库libaacarray。因此导出一个函数Java_com_spoledge_aacplayer_ArrayDecoder_nativeStart,那么相应的java类必须是com.spoledge.aacplayer。ArrayDecoder没有办法绕过它。除非您也想调整和重新编译本机库。