Android Development - Execute on Phone From Eclipse?

When developing an Android App I can not see my physical phone in Eclipse while plugged in. This prevents me from being able to execute my app on my phone. Is there anything special that I need to do to make Eclipse work with my phone like in Windows?

On Fri 26 Apr 2013 02:26:02 PM CDT, tdrusk wrote:

When developing an Android App I can not see my physical phone in
Eclipse while plugged in. This prevents me from being able to execute my
app on my phone. Is there anything special that I need to do to make
Eclipse work with my phone like in Windows?

Hi
Probably a udev rule, have a read of this thread;
http://forums.opensuse.org/showthread.php?t=486054


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 1 day 17:10, 3 users, load average: 0.15, 0.09, 0.12
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale

I appreciate the input, but I am unsure what the best course of action is to get this to work. Does anyone have a step-by-step?

On Fri 26 Apr 2013 05:56:03 PM CDT, tdrusk wrote:

I appreciate the input, but I am unsure what the best course of action
is to get this to work. Does anyone have a step-by-step?

Hi
When you plug the device in, open a terminal and run the command dmesg,
can you provide the vendor and device ID’s?


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 1 day 21:09, 3 users, load average: 0.02, 0.03, 0.05
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale

Thanks for your reply. This is my dmesg. I will need to research these drops…

It looks like what we want is right here.

[101645.022406] usb 1-1: USB disconnect, device number 21
[101645.258181] usb 1-1: new high-speed USB device number 22 using ehci_hcd
[101645.386718] usb 1-1: New USB device found, idVendor=22b8, idProduct=7087
[101645.386730] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[101645.386738] usb 1-1: Product: MB860
[101645.386744] usb 1-1: Manufacturer: Motorola
[101645.386754] usb 1-1: SerialNumber: TA2070JJFG
[101645.392957] scsi20 : usb-storage 1-1:1.0
[101646.349274]  SFW2-INext-DROP-DEFLT IN=eth0 OUT=  MAC=60:eb:69:3f:b4:bc:98:4b:4a:97:f9:b2:08:00 SRC=10.0.10.126  DST=10.0.10.112 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=34227 DF PROTO=TCP  SPT=49485 DPT=57621 WINDOW=5840 RES=0x00 SYN URGP=0 OPT  (020405B40402080A00C74BA80000000001030304) 
[101646.394558] scsi 20:0:0:0: Direct-Access     Motorola MB860            0000 PQ: 0 ANSI: 2
[101646.396774] sd 20:0:0:0: Attached scsi generic sg6 type 0
[101646.399468] scsi 20:0:0:1: Direct-Access     Motorola MB860            0000 PQ: 0 ANSI: 2
[101646.399741] sd 20:0:0:1: Attached scsi generic sg7 type 0
[101646.424880] sd 20:0:0:1: [sdg] Attached SCSI removable disk
[101646.427074] sd 20:0:0:0: [sdf] Attached SCSI removable disk
[101649.342998]  SFW2-INext-DROP-DEFLT IN=eth0 OUT=  MAC=60:eb:69:3f:b4:bc:98:4b:4a:97:f9:b2:08:00 SRC=10.0.10.126  DST=10.0.10.112 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=34228 DF PROTO=TCP  SPT=49485 DPT=57621 WINDOW=5840 RES=0x00 SYN URGP=0 OPT  (020405B40402080A00C74CD40000000001030304) 
[101652.604049] sd 20:0:0:0: [sdf] 22467584 512-byte logical blocks: (11.5 GB/10.7 GiB)
[101652.606174] sd 20:0:0:0: [sdf] No Caching mode page present
[101652.606182] sd 20:0:0:0: [sdf] Assuming drive cache: write through
[101652.611146] sd 20:0:0:0: [sdf] No Caching mode page present
[101652.611153] sd 20:0:0:0: [sdf] Assuming drive cache: write through

On Fri 26 Apr 2013 08:06:02 PM CDT, tdrusk wrote:

malcolmlewis;2551451 Wrote:
> Hi
> When you plug the device in, open a terminal and run the command
> dmesg, can you provide the vendor and device ID’s?
>
> –
> Cheers Malcolm °¿° (Linux Counter #276890)
> openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
> up 1 day 21:09, 3 users, load average: 0.02, 0.03, 0.05
> CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale
Thanks for your reply. This is my dmesg. I will need to research these
drops…

It looks like what we want is right here.

[101645.386718] usb 1-1: New USB device found, idVendor=22b8, idProduct=7087

Hi
OK, as you user open your favorite text editor and create a new file
called: 51-android.rules, then copy/paste the following in the file;


# Android devices - UDEV Rule

# For Motorola MB860 device
SUBSYSTEM=="usb", ATTRS{idVendor}==22b8"", ATTRS{idProduct}=="7087", SYMLINK+="libmtp-%k", MODE="0666", GROUP="users"

Save the file (remember where you saved it :wink: );

Now open a terminal session and change to root user;


su -
cd /usr/lib/udev/rules.d/
cp <path_to_file>/51-android.rules .
chmod 0644 51-android.rules
udevadm trigger
exit
{Plug your device in}
cd to the adb file location

./adb devices

You should see your device?


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 1 day 22:58, 5 users, load average: 0.00, 0.01, 0.05
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale

Oh man! We are getting really close.

When I run ./adb devices I get

List of devices attached 
emulator-5554   device
????????????    no permissions


any ideas?

On Sat 27 Apr 2013 03:56:02 PM CDT, tdrusk wrote:

malcolmlewis;2551491 Wrote:
> Hi
> OK, as you user open your favorite text editor and create a new file
> called: 51-android.rules, then copy/paste the following in the file;
> >
Code:

> >
> # Android devices - UDEV Rule
>
> # For Motorola MB860 device
> SUBSYSTEM==“usb”, ATTRS{idVendor}==22b8"",
ATTRS{idProduct}==“7087”, SYMLINK+=“libmtp-%k”, MODE=“0666”,
GROUP=“users” > --------------------
> >
> Save the file (remember where you saved it :wink: );
>
> Now open a terminal session and change to root user;
> >
Code:

> >
> su -
> cd /usr/lib/udev/rules.d/
> cp <path_to_file>/51-android.rules .
> chmod 0644 51-android.rules
> udevadm trigger
> exit
> {Plug your device in}
> cd to the adb file location
>
> ./adb devices
>

> >
> You should see your device?
>

Oh man! We are getting really close.

When I run ./adb devices I get

Code:

List of devices attached
emulator-5554 device
??? no permissions


any ideas?

Hi
On your device, can you enable usb debugging?


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 2 days 19:09, 5 users, load average: 0.03, 0.04, 0.05
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale

Hi
Also re-check the rule for any typos, I can duplicate if the rule isn’t present or has a typo.

Wahoo! I got it working.

Okay so this is what I did.

Enable debugging on your phone.
settings -> applications -> development

I am not sure if this is necessary, but I installed this.


sudo zypper install libmtp-devel


I plugged in my phone and ran dmesg.
In dmesg I found this:

[14349.828722] usb 1-3: New USB device found, idVendor=22b8, idProduct=7090[14349.828733] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14349.828741] usb 1-3: Product: MB860
[14349.828747] usb 1-3: Manufacturer: Motorola
[14349.828751] usb 1-3: SerialNumber: TA2070JJFG

This means my 51-android.rules looks like this:


 # Android devices - UDEV Rule

# For Motorola MB860 device
SUBSYSTEM=="usb", ATTRS{idVendor}==22b8"", ATTRS{idProduct}=="7090", SYMLINK+="libmtp-%k", MODE="0666", GROUP="users"

It’s kind of obvious where I got the numbers from… Adjust the numbers to your numbers.

I applied this to what malcolmlewis suggested.

Hi
OK, as you user open your favorite text editor and create a new file
called: 51-android.rules, then copy/paste the following in the file;


 # Android devices - UDEV Rule

# For Motorola MB860 device
SUBSYSTEM=="usb", ATTRS{idVendor}==22b8"", ATTRS{idProduct}=="7090", SYMLINK+="libmtp-%k", MODE="0666", GROUP="users"


su -
cd /usr/lib/udev/rules.d/
cp <path_to_file>/51-android.rules .
chmod 0644 51-android.rules
udevadm trigger
exit
{Plug your device in}
cd to the adb file location

Notes: the ./adb file should be in your sdk/platform-tools folder. Also, note the . in the cp command above.

I am not sure if this part is necessary. Try skipping these next 2 commands and see if you don’t need it, but here goes.

chown root:user_group adb
chmod 4550 adb

Okay, so finally, I had to restart adb.



sudo ./adb kill-serversudo ./adb start-sever prsudo ./adb devices

The last command should show your device now.

Close out of eclipse if open, and reopen it. Right click on your project, go to run as -> run configuration. Click target and click (Always prompt to pick device). Now when you run it you should see your phone listed. Enjoy!

Thanks malcolmlewis!

On Sat 27 Apr 2013 08:36:01 PM CDT, tdrusk wrote:

Wahoo! I got it working.

chown root:user_group adb
chmod 4550 adb

Hi
I run adb as standalone sitting in my ~/bin directory so there was no
need for me to change any permissions. Since it’s in eclipse and
possibly installed systemwide then you may need to set permissions. I
generally run stuff like that at a user level rather than install
systemwide… YMMV.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 2 days 23:37, 4 users, load average: 0.21, 0.17, 0.14
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Arrandale