androidubuntunetbeansremote-debuggingandroid-virtual-device

NetBeans unable to connect to Android Emulator AVD


i use NetBeans to develop an HTML5 cordova-based android app. Netbeans and android SDK is installed on an linux Workstation - Ubuntu 14.04 (x64).

For that, I like to run the app insight an existing (and running) android emulator (AVD). The AVD works fine and is also reachable using telnet:

$ telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK

But: if I try to execute/run the app in NetBeans, NB returns 2 dialog boxes:

info: Connecting to android device...

and

error: Please run Android Emulator

I had the same setup on windows running out of the box. But it is not working on ubuntu.

So my question is: how to debug this problem and what could be the reason, why NetBenas does not find the emulator?

Is there an NetBeans setting somewhere?

//Edit: with the Help of @ladar i found out, that an library is missing:

libstdc++.so.6: cannot open shared object file

This library is needed by adb, which is startet by NetBeans. But: After installing libx32stdc++6 and libx64stdc++6 the error still exists. adbis unable to locate that library:

$ ldd /opt/android-sdk-linux/platform-tools/adb
    linux-gate.so.1 =>  (0xf778d000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf7632000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf762d000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7610000)
    libstdc++.so.6 => not found
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf75ca000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf75ad000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf73fd000)
    /lib/ld-linux.so.2 (0xf778e000)

The 32bit files was placed in. /usr/libx32/. So I added an link to /lib/i386-linux-gnu/. Running strace recognizances the library at its new possition, but still resuolts in an error:

$ strace /opt/android-sdk-linux/platform-tools/adb
execve("/opt/android-sdk-linux/platform-tools/adb", ["/opt/android-sdk-linux/platform-"...], [/* 64 vars */]) = 0
[ Process PID=15558 runs in 32 bit mode. ]
brk(0)                                  = 0xfffffffff7913000
[...]
open("/lib/i386-linux-gnu/cmov/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/i386-linux-gnu/cmov", 0xffa155b0) = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\243\4\0004\0\0\0"..., 512) = 512
close(3)                                = 0
stat64("/lib/i386-linux-gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/i386-linux-gnu/tls/i686/sse2/cmov/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/tls/i686/sse2/cmov", 0xffa155b0) = -1 ENOENT (No such file or directory)
[...]
writev(2, [{"/opt/android-sdk-linux/platform-"..., 41}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libstdc++.so.6", 14}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"No such file or directory", 25}, {"\n", 1}], 10/opt/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
) = 155
exit_group(127)                         = ?
+++ exited with 127 +++

...and I have no idea why....


Solution

  • I like to answer my own question for the case, that someone has the same issue: installing the 32bit versions of several packages did not solve the problem.

    The point is to install the ...-dev packages too. The following line solves the problem:

    sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev