This is the correct way to add a compiled library:
libs
in the project.Has anyone come across this before?
http://code.google.com/p/aacdecoder-android/
I am trying (desperately) to get it to work. Here are the steps I've followed:
aacdecoder-android-libs-0.5.zip
).lib
in the project.I've put in the sample code on the google code page and yet I'm getting this error:
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)
What am I doing wrong?? Can anyone help? Can anyone get that particular library to work at all: I need to play an AAC stream (eg: http://media-ice.musicradio.com/Capital ).
Thanks
UPDATE
I added the library files (the.jar and the.so) to a different folder libs
this time (with s
).
Going through the same steps as above produces this new error:
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)
What is the problem here? I don't understand the Unknown host
error, because its evident that the above url exists. If this is a library specific issue then don't worry. :/
To answer your second question regarding the 'Unknown host' error (which actually says 'Permission denied' in its root cause, which makes more sense): You need to declare the INTERNET
permission in your AndroidManifest.xml
, such as:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..." [...]>
[...]
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
[...]
</manifest>
For further details about the Android permission concept, refer to: http://developer.android.com/guide/topics/security/security.html
Try right clicking the project, then going to properties > java build path.
You have to extract the file aacdecoder-android-libs-0.5.zip, this will revleal aacdecoder-android-0.5.jar and a folder named armeabi containing a static library.
To use the library copy the folder and the aacdecoder-android-0.5.jar into your libs folder. And add the jar to your buildpath (as you did with the zip before).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.