这是添加已编译库的正确方法:
libs
的文件夹中。以前有人遇到过这个吗?
http://code.google.com/p/aacdecoder-android/
我正在努力(绝望地)让它发挥作用。以下是我遵循的步骤:
aacdecoder-android-libs-0.5.zip
)。lib
的文件夹中。我在谷歌代码页上输入了示例代码但是我收到了这个错误:
W/dalvikvm( 405): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
E/AndroidRuntime( 405): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 405): java.lang.UnsatisfiedLinkError: Library aacdecoder not found
E/AndroidRuntime( 405): at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 405): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.Decoder.loadLibrary(Decoder.java:167)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.Decoder.create(Decoder.java:188)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.Decoder.create(Decoder.java:178)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.AACPlayer.createDecoder(AACPlayer.java:407)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.AACPlayer.<init>(AACPlayer.java:121)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.AACPlayer.<init>(AACPlayer.java:104)
E/AndroidRuntime( 405): at com.spoledge.aacdecoder.AACPlayer.<init>(AACPlayer.java:95)
E/AndroidRuntime( 405): at com.tclayson.furadio.FURadioActivity.onCreate(FURadioActivity.java:14)
E/AndroidRuntime( 405): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime( 405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
E/AndroidRuntime( 405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 405): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime( 405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime( 405): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 405): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 405): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime( 405): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 405): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime( 405): at dalvik.system.NativeStart.main(Native Method)
我做错了什么?!有人可以帮忙吗?任何人都可以让特定的图书馆工作吗?我需要播放AAC流(例如:http://media-ice.musicradio.com/Capital)。
由于
更新
这次我将库文件(.jar和.so)添加到另一个文件夹libs
(使用s
)。
执行上述相同步骤会产生以下新错误:
D/ddm-heap( 436): Got feature list request
D/dalvikvm( 436): Trying to load lib /data/data/com.tclayson.furadio/lib/libaacdecoder.so 0x4376acc8
D/dalvikvm( 436): Added shared lib /data/data/com.tclayson.furadio/lib/libaacdecoder.so 0x4376acc8
D/dalvikvm( 436): No JNI_OnLoad found in /data/data/com.tclayson.furadio/lib/libaacdecoder.so 0x4376acc8
I/InetAddress( 436): Unknown host media-ice.musicradio.com, throwing UnknownHostException
E/AACPlayer( 436): playAsync():
E/AACPlayer( 436): java.net.SocketException: Permission denied (maybe missing INTERNET permission)
E/AACPlayer( 436): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native Method)
E/AACPlayer( 436): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java:85)
E/AACPlayer( 436): at org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java:59)
E/AACPlayer( 436): at java.net.Socket.checkClosedAndCreate(Socket.java:829)
E/AACPlayer( 436): at java.net.Socket.connect(Socket.java:984)
E/AACPlayer( 436): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:67)
E/AACPlayer( 436): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:151)
E/AACPlayer( 436): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:73)
E/AACPlayer( 436): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:826)
E/AACPlayer( 436): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:812)
E/AACPlayer( 436): at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:259)
E/AACPlayer( 436): at com.spoledge.aacdecoder.AACPlayer$1.run(AACPlayer.java:230)
E/AACPlayer( 436): at java.lang.Thread.run(Thread.java:1060)
这是什么问题?我不理解Unknown host
错误,因为很明显上面的url存在。如果这是图书馆特定问题,请不要担心。 :/
答案 0 :(得分:1)
回答关于“未知主机”错误的第二个问题(其根本原因实际上表示“权限被拒绝”,这更有意义):您需要在{{1}中声明INTERNET
权限例如:
AndroidManifest.xml
有关Android权限概念的更多详细信息,请参阅:http://developer.android.com/guide/topics/security/security.html
答案 1 :(得分:0)
尝试右键单击项目,然后转到属性&gt; java build path。
答案 2 :(得分:0)
你必须提取文件aacdecoder-android-libs-0.5.zip,这将使aacdecoder-android-0.5.jar和一个名为armeabi的文件夹包含一个静态库。
使用库将文件夹和aacdecoder-android-0.5.jar复制到libs文件夹中。并将jar添加到构建路径中(就像之前使用zip一样)。