0

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

ALF
  • 1
  • 1
  • 1
  • 1
    "crashes" is too imprecise a term for there to be much likelihood of anyone understanding the problem. Post both any UI error messages and the logcat log from the attempt to start the program. – Chris Stratton Jul 29 '11 at 19:54
  • 08-01 10:13:55.570: WARN/dalvikvm(6348): threadid=1: thread exiting with uncaught exception (group=0x4016d760) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): FATAL EXCEPTION: main 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.native_activity/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.example.native_activity/lib/libnative-activity.so – ALF Aug 01 '11 at 17:20
  • 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread.access$1500(ActivityThread.java:122) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005) 08-0110:13:55.580:ERROR/AndroidRuntime(6348):at android.os.Handler.dispatchMessage(Handler.java:99) – ALF Aug 01 '11 at 17:21
  • 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.os.Looper.loop(Looper.java:132) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread.main(ActivityThread.java:4028) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at java.lang.reflect.Method.invokeNative(Native Method) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at java.lang.reflect.Method.invoke(Method.java:491) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844) – ALF Aug 01 '11 at 17:22
  • 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at dalvik.system.NativeStart.main(Native Method) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): Caused by: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.example.native_activity/lib/libnative-activity.so 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.NativeActivity.onCreate(NativeActivity.java:199) – ALF Aug 01 '11 at 17:22
  • 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) 08-01 10:13:55.580: ERROR/AndroidRuntime(6348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715) – ALF Aug 01 '11 at 17:22
  • There really needs to be a way to post more than 600 characters in a follow-up... – ALF Aug 01 '11 at 17:22

1 Answers1

0

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.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Thanks! I don't have another device I can test on, but after speaking with a coworker am thinking it's an Android version incompatibility. Native Audio is for API level 9 and my Tab is API level 12 (I think). I'd assumed forward compatibility of API levels, but that's not the case. If correct, this menas API 2.3 devices should support native audio, but 3.1 devices will not. True? – ALF Aug 01 '11 at 21:17
  • @ALF I doubt it has been removed from 3.1, though it's possible it could be inadvertently broken on a particular vendor release. Why not try to identify the exact problem instead of just giving up? – Chris Stratton Aug 02 '11 at 16:18
  • Someone else appears to have discovered that the library is missing from the IO 10.1 tabs but believes it to be required by the google CTS suite: http://forum.xda-developers.com/archive/index.php/t-1119189.html So probably what you have is pre-consumer examples. That link also includes a suggested workaround; with a little creativity you may be able to load the library from elsewhere and avoid needing to root. – Chris Stratton Aug 02 '11 at 18:16
  • Thanks for the follow-up, Chris! I've gotten sidetracked by other priorities on my project so haven't seed your response until now. I've asked to see if we can update our devices to the latest consumer version, which hopefully will eliminate the issue. – ALF Nov 03 '11 at 20:45