user576716
user576716

Reputation: 21

Debugging an Android application directly on a device

I'm developing for Android under Ubuntu 10.04 with Eclipse and also with Intellij Idea. If I deploy and debug on virtual devices everything is OK.

I would like to run my applications directly on my Samsung Galaxy Tab. Therefore I plugged it to the USB port, switched on the "USB Debugging" in the Settings and I added a udev rule for the galaxy tab.

If i call ~/android-sdk-linux_86/platform-tools/adb devices I get also the output, that my samsung galaxy tab is connected. The output is:

List of devices attached
1000abdb6248 device

Its also possible to connect to the logcat. If i call ./adb logcat I get the log from my galaxy tab.

I am sure, this is my galaxy tab. Because when I plug off the tab, this device disappears.

But unfortunately I do not see the device in Eclipse or Idea in the AVD Manager.

The "Choose Device" dialog is empty. But I am able to start virtual devices without problems.

Any idea how to run and debug application directly on the galaxy tab from the IDE?

Thanks
frafu

Upvotes: 1

Views: 3125

Answers (3)

sgroh
sgroh

Reputation: 354

Please note that newer SDKs contains a txt file (adb_has_moved.txt) under the folder tools that says:

The adb tool has moved to platform-tools/

If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"

Please also update your PATH environment variable to include the platform-tools/ directory, so you can execute adb from any location.

Solution 1:

Create a soft link to the abd binary and adding it to your path.

ln -s ./platform-tools/abd ./tools/abd

edit your .bashrc and add:

PATH= :/opt/android-sdk-linux/tools:$PATH
export PATH

Solution 2:

Avoid creating the link and modify your path as suggested above:

PATH= /opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:$PATH
export PATH

This works for eclipse and also IntelliJ IDEA. I hope this helps someone

Upvotes: 0

Neo
Neo

Reputation: 11577

The adb tool has moved to platform-tools/

If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"

Please also update your PATH environment variable to include the platform-tools/ directory, so you can execute adb from any location.

so:

 ln -s ./platform-tools/adb ./tools/adb

also make sure eclipse has necessary permission.

Upvotes: 1

user576716
user576716

Reputation: 21

SOLVED! In eclipse it was my fault. I don't know why, but after some stops and starts from eclipse and the adb server it worked.

In IntelliJ Idea I found the error, because I launched the IDE accidentally from the command line and saw an error in the console: 31:42 E/adb: Failed to get the adb version: Cannot run program "/home/frafu/devtools/android-sdk-linux_86/tools/adb": java.io.IOException: error=2, No such file or directory

That seems to be a Idea failure or i missconfigured something. The adb executable is not located in /tools but in /platform-tools. So I made an symlink in tools/adb -> ../platform-tools/adb and now also IntelliJ Idea runs!

Thank you for your attention. :-)

frafu

Upvotes: 1

Related Questions