Android NDK 本机音频示例崩溃
我已经构建了本机音频示例并将其下载到我的 Galaxy Tab 10.1,但它不起作用。看起来它即将启动(即窗口名称出现在顶部),但随后严重崩溃。我希望有人能知道为什么?可能是选项卡上的音频支持有问题,或者......?
我还尝试使用“android_native_app_glue”创建我自己的非常简单的本机活动,它也崩溃了——即使我没有进行 OpenSL 调用。事实上,我所要做的就是将 -lOpenSLES 添加到我的 LOCAL_LDLIBS 中以导致启动崩溃。当我删除该链接器标志时,没有崩溃。很奇怪,让我觉得选项卡中缺少有关本机音频支持的东西?
谢谢, 阿尔法
I've built the native-audio example and downloaded it to my Galaxy Tab 10.1, but it doesn't work. It looks like it's going to start (i.e. the window name appears across the top), but then crashes hard. I'm hoping someone might have an idea as to why? Is it perhaps a problem with audio support on the Tab, or...?
I also tried creating my own very simple native activity using "android_native_app_glue" and it crashes too -- even though I make no OpenSL calls. In fact, all I have to do is add -lOpenSLES to my LOCAL_LDLIBS to cause a startup crash. When I remove that linker flag, no crash. Very odd and makes me think there's just something missing from the Tab with regards to native audio support?
Thanks,
ALF
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您 logcat 似乎表明加载 /data/data/com.example.native_activity/lib/libnative-activity.so 失败。如果无法复制问题来验证将导致的错误消息,这很可能是由于运行时链接器无法找到要加载的引用系统库,或者可能是无法找到 libnative 的令人困惑的报告 - Activity.so 本身,或者 lib 中未解析的符号,或者其他东西。
如果您有另一台设备要测试,那将是一条明显的路径。
还测试来自已知使用本机音频的其他人的编译应用程序。
如果这些都不可能,您可能可以使用 readelf 或 objdump (尤其是 ndk 安装中的 android 版本)甚至 strings 或 grep 来查找 libnative-activity.so 所需的系统库的名称,然后查看它们是否实际上存在于您的设备上。
You logcat seems to indicate that loading of /data/data/com.example.native_activity/lib/libnative-activity.so is failing. Without being able to duplicate the problem to verify the error messages that would result, this might well be due to the runtime linker being unable to find a referenced system library to load, or it could be a confusing report of being unable to find libnative-activity.so itself, or and unresolved symbol in the lib, or something else.
If you had another device to test on, that would be an obvious path.
Also testing a compiled app from someone else known to use native audio.
If neither of those is possible, you could probably use readelf or objdump (especially the android version somewhere in the ndk install) or even strings or grep to find the names of system libraries required by your libnative-activity.so and then see if they are in fact present on your device.