Debugging Android App on Device

2020-03-07 02:55发布

I know there are many questions about this but none of them helped my situation.I'm running Ubuntu 11.10 and I'm trying to debug an app on my LG phone. I followed this guide: http://developer.android.com/guide/developing/device.html

I enabled USB debugging on my phone,set the project to debuggable in the manifest, and edited the /etc/udev/rules.d/51-android.rules rules file. Here is the contents of the file:

SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev" 

1004 is the vendor ID for LG. The device is mounted; I can access it in my filesystem and the USB mounted indicator is in the notifications area. When I run adb devices, the phone is not listed, only the emulator is. It is also not recognized in Eclipse. How can I get Eclipse to recognize my device?

5条回答
小情绪 Triste *
2楼-- · 2020-03-07 03:11

Here is my ultimate script to adding rules for all Android devices. You should delete your xx-android.rules files if you wrote it and make this with sudo:

#!/bin/bash

android_SDK=$1

if [[ $android_SDK == "" ]]
then
    echo 'usage: sudo add_device_rules_to_unix.sh /android-SDK/platform-tools/dir/path'
    exit
fi

PATH=$PATH:$android_SDK

rules_file="/etc/udev/rules.d/99-android.rules"

# Adding rules to 99-android.rules file
echo '# Acer
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
# Dell
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
# Foxconn
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
# Garmin-Asus
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
# Google
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
# HTC
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
# Huawei
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
# LG
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
# Motorola
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
# Nvidia
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
# Pantech
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
# Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
# Sharp
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
# Sony Ericsson
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
# ZTE
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"' > $rules_file

# Applying rules and restarting adb
chmod a+r $rules_file
service udev restart
adb kill-server
adb start-server

Hope it helps you.

查看更多
你好瞎i
3楼-- · 2020-03-07 03:11

There is an extra step on 64 bit Ubuntu: apt-get install ia32-libs

Maybe this is the issue?

查看更多
ら.Afraid
4楼-- · 2020-03-07 03:15

Try searching for generic adb drivers for LG for Ubuntu, install them, reboot and connect your phone. Then go to terminal, navigate to folder with adb and use the following command to see if your device is recognised:

./adb devices

If it shows your device, it is ready to be used with android sdk.

查看更多
▲ chillily
5楼-- · 2020-03-07 03:20

You should install usb-drivers for your device (even if you have access with your file system). Maybe it's a standart driver, that allows you to use SD card on your phone (but nothing more).

查看更多
Viruses.
6楼-- · 2020-03-07 03:35

I found my problem. The Android guide says to name the udev file 51-android.rules. But for newer version of Ubuntu (Karmic and sooner) it needs to be names 70-android.rules. This is the tutorial I followed: http://esausilva.com/2010/05/13/setting-up-adbusb-drivers-for-android-devices-in-linux-ubuntu/. Thanks for your answers though.

查看更多
登录 后发表回答