在设备上调试安卓应用[英] Debugging Android App on Device

本文是小编为大家收集整理的关于在设备上调试安卓应用的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我知道这有很多问题,但它们都没有帮助我的情况.我遵循了本指南: http://developer.android.com/guide.com/guide.com/guide/guide/develvevice/developing/device/device. html

我在手机上启用了USB调试,将项目设置为在清单中进行辩论,并编辑了/Etc/udev/rules.d/51-android.rules规则文件.这是文件的内容:

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

1004是LG的供应商ID.设备已安装;我可以在文件系统中访问它,并且USB挂载的指示器位于"通知"区域.当我运行ADB设备时,没有列出手机,仅仿真器就是.它在日食中也没有认可.我如何获得日食以识别我的设备?

推荐答案

这是我为所有Android设备添加规则的最终脚本.如果您编写并使用sudo进行此文件,则应删除xx android.rules文件:

#!/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

希望它对您有帮助.

其他推荐答案

我发现了我的问题. Android指南说要命名UDEV文件51 android.rules.但是对于较新版本的Ubuntu(业力和更早),它需要是名称70 Android.rules.这是我遵循的教程: http://esausilva.com/2010/05/13/setting-up-adbusb-drivers-for-drivers-for-android-devices-in-linux-ubuntu/.不过感谢您的回答.

其他推荐答案

您应该为设备安装USB驱动程序(即使您可以使用文件系统访问).也许这是一个引人注目的驱动程序,可以让您在手机上使用SD卡(但仅此而已).

本文地址:https://www.itbaoku.cn/post/102655.html

问题描述

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?

推荐答案

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

其他推荐答案

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