Error with ndk-gdb of android-ndk-r9d-linux-x86 in

2019-04-28 18:01发布

问题:

I use ndk-gdb of android-ndk-r9d-linux-x86 in ubuntu 12.04 to debug the android native application "hello-jni", but it receive this error.

  WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in               scripts, things can happen.
  .../adt-bundle-linux-x86-20140321/android-ndk-r9d/ndk-gdb: 143: .../adt-bundle-linux-x86-20140321/android-ndk-r9d/ndk-gdb: Bad substitution
  .../adt-bundle-linux-x86-20140321/android-ndk-r9d/ndk-gdb: 555: [: 1: unexpected operator
  .../adt-bundle-linux-x86-20140321/android-ndk-r9d/ndk-gdb: 771: [: armeabi-v7a: unexpected operator

but the android-ndk-r8e-linux-x86 is ok, i wonder why? Thanks.

回答1:

I believe 'ndk-gdb' has been deprecated in favor of 'ndk-gdb.py' (although this has not been widely advertised, IMO.) Using r9d, I had the same problem you reported above, but the python version worked without issue.



回答2:

WARNING: The shell running this script isn't bash. Although we try to avoid bashism in scripts, things can happen. --- This means you are using something like dash.

Change /bin/sh to /bin/bash will solve the warning and the "bad substitution" problem.