Debugging Android App on Device

主宰稳场 提交于 2019-12-30 07:27:11

问题


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?


回答1:


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.




回答2:


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.




回答3:


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).




回答4:


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.




回答5:


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

Maybe this is the issue?



来源:https://stackoverflow.com/questions/8638635/debugging-android-app-on-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!