现在的位置: 首页 > 综合 > 正文

Fedora下Android开发真机调试参考

2013年09月12日 ⁄ 综合 ⁄ 共 2273字 ⁄ 字号 评论关闭

  方法很简单,需要注意的是并不是所有机型都可用。

  先说说 装eclipse 和ADT

  自带那个eclipse可以满足 一般javaSE 使用,但是不知道为什么,Fedora17装ADT-20问题。

  所以你自己需要去eclipse官方网站重新下一个,自己装ADT。

 

  直接不能调试的:

[luozhuang@luozhuangVM tools]$ sudo ./ddms
Error Loading DDMS Preferences

(DDMS:3585): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 17

(DDMS:3585): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 17
09:30:20 E/DDMS: insufficient permissions for device
com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device
        at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:752)
        at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
        at com.android.ddmlib.Device.executeShellCommand(Device.java:453)
        at com.android.ddmuilib.SysinfoPanel.loadFromDevice(SysinfoPanel.java:159)
        at com.android.ddmuilib.SysinfoPanel.deviceSelected(SysinfoPanel.java:126)
        at com.android.ddmuilib.SelectionDependentPanel.deviceSelected(SelectionDependentPanel.java:52)
        at com.android.ddms.UIThread.selectionChanged(UIThread.java:1756)
        at com.android.ddmuilib.DevicePanel.notifyListeners(DevicePanel.java:772)
        at com.android.ddmuilib.DevicePanel.notifyListeners(DevicePanel.java:760)
        at com.android.ddmuilib.DevicePanel.access$1100(DevicePanel.java:56)
        at com.android.ddmuilib.DevicePanel$1.widgetSelected(DevicePanel.java:368)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
        at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
        at com.android.ddms.UIThread.runUI(UIThread.java:535)
        at com.android.ddms.Main.main(Main.java:117)

很多人说是因为Linux 没有root权限,我们可以从上面结果看到,使用sudo也不行。

  真机调试很简单:编辑一个配置文件,然后设置权限,最后重新启动服务:

[luozhuang@luozhuangVM tools]$ sudo gedit /etc/udev/rules.d/70-android.rules
[luozhuang@luozhuangVM tools]$ sudo chmod 777 /etc/udev/rules.d/70-android.rules
[luozhuang@luozhuangVM tools]$ sudo service udev restart
Redirecting to /bin/systemctl  restart udev.service

 70-android.rules文件内容如下:

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"

最后要重新插入你的设备,然后运行ddms就应该能看到设备了。

抱歉!评论已关闭.