gpt4 book ai didi

java - 尝试使用外部 .jar 在 Android 中不起作用

转载 作者:行者123 更新时间:2023-12-01 15:02:45 25 4
gpt4 key购买 nike

我正在尝试让一个小的 aac radio 流在 Android 应用程序中播放。我正在尝试使用http://code.google.com/p/aacdecoder-android/但我在 code.google.com 上从来没有太幸运,因为我发现很多项目很难使用。

我下载了 zip,并且我认为我在项目属性中正确设置了它。

当我尝试运行代码行来播放文件时,出现此错误:

11-15 16:28:25.750: E/AndroidRuntime(3626): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load aacdecoder: findLibrary returned null

我使用的代码是这样的:

import com.spoledge.aacdecoder.AACPlayer;
...
AACPlayer aacPlayer = new AACPlayer();
aacPlayer.playAsync( "http://..." );

有什么想法吗?我不认为这是 aacdecoder 项目本身,我认为我实际上设置不正确。我在 eclipse 中没有看到任何红线。有想法吗?

enter image description here

最佳答案

您似乎忘记复制 *.so ( native 库),因为我刚刚创建了新项目,将 *.jar 添加到 Java构建路径(您已经完成了)并且它在流中播放良好。我的代码:

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new Button(this));

AACPlayer aacPlayer = new AACPlayer();
aacPlayer.playAsync( "http://http.yourmuze.com:8000/play/paradise/h.aac" );
}

不要忘记添加权限:

<uses-permission android:name="android.permission.INTERNET"/>

关于java - 尝试使用外部 .jar 在 Android 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13406643/

25 4 0
文章推荐: java - document..isAlive() 在某些浏览器中失败