简体   繁体   中英

Android NDK native-audio example crashes

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 (ie 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

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?

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM