java 如何使用android studio设置运行设备?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28796098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:11:52  来源:igfitidea点击:

How to set a running device with android studio?

javaandroidsamsung-mobile

提问by Jnuker

I want to connect an android device to test my application directly from my environment android studio

我想连接一个 android 设备以直接从我的环境 android studio 测试我的应用程序

android studio - http://developer.android.com/sdk/index.html

安卓工作室 - http://developer.android.com/sdk/index.html

I have a samsung galaxy s5 device, I've connected it to usb, I've installed this drivers:

我有一个三星 Galaxy s5 设备,我已经将它连接到 USB,我已经安装了这个驱动程序:

http://developer.samsung.com/technical-doc/view.do?v=T000000117

http://developer.samsung.com/technical-doc/view.do?v=T000000117

and there are said that:

据说:

The USB Driver for Windows is available for download in this page. You need the driver only if you are developing on Windows and want to connect a Samsung android device to your development environment over USB.

so, in my windows 7 device mananger I see that in the section "portable devices" the phone is listed, and its name is identified, but in the android studio when I run my application, then I should select if a want to run it with a virtual or real device, so in the list of running devices in android studio, my device is not listed, I 've tried to restart the pc, but no results, can anyone tell me what I'am doing wrong? I can't understand...

因此,在我的 Windows 7 设备管理器中,我看到在“便携式设备”部分列出了手机,并确定了其名称,但是在运行我的应用程序时在 android studio 中,我应该选择是否要运行它使用虚拟或真实设备,所以在 android studio 的运行设备列表中,我的设备没有列出,我尝试重新启动电脑,但没有结果,谁能告诉我我做错了什么?我无法理解...

回答by Chintan Soni

I guess the drivers are not compatible. Try installing the drivers that come with android sdk.

我猜驱动程序不兼容。尝试安装 android sdk 附带的驱动程序。

To install the Android USB driver on Windows 7 for the first time:

首次在 Windows 7 上安装 Android USB 驱动程序:

  1. Connect your Android-powered device to your computer's USB port.

  2. Right-click on Computer from your desktop or Windows Explorer, and select Manage.

  3. Select Devices in the left pane. Locate and expand Other device in the right pane.

  4. Right-click the device name (such as Nexus S) and select Update Driver Software.This will launch the Hardware Update Wizard.

  5. Select Browse my computer for driver software and click Next.
  6. Click Browse and locate the USB driver folder. (The Google USB Driver is located in \extras\google\usb_driver.)
  7. Click Next to install the driver.
  1. 将 Android 设备连接到计算机的 USB 端口。

  2. 在桌面或 Windows 资源管理器中右键单击“计算机”,然后选择“管理”。

  3. 在左侧窗格中选择设备。在右侧窗格中找到并展开其他设备。

  4. 右键单击设备名称(例如 Nexus S)并选择更新驱动程序软件。这将启动硬件更新向导。

  5. 选择浏览我的计算机以查找驱动程序软件,然后单击下一步。
  6. 单击浏览并找到 USB 驱动程序文件夹。 (Google USB 驱动程序位于 \extras\google\usb_driver 中。)
  7. 单击下一步安装驱动程序。

Or, to upgrade an existing Android USB driver on Windows 7 with the new driver:

或者,要使用新驱动程序在 Windows 7 上升级现有的 Android USB 驱动程序:

  1. Connect your Android-powered device to your computer's USB port.
  2. Right-click on Computer from your desktop or Windows Explorer, and select Manage.
  3. Select Device Manager in the left pane of the Computer Management window.
  4. Locate and expand Android Phone in the right pane.
  5. Right-click Android Composite ADB Interface and select Update Driver. This will launch the Hardware Update Wizard.
  6. Select Install from a list or specific location and click Next.
  7. Select Search for the best driver in these locations; un-check Search removable media; and check Include this location in the search.
  8. Click Browse and locate the USB driver folder. (The Google USB Driver is located in \extras\google\usb_driver.)
  9. Click Next to upgrade the driver.
  1. 将 Android 设备连接到计算机的 USB 端口。
  2. 在桌面或 Windows 资源管理器中右键单击“计算机”,然后选择“管理”。
  3. 在计算机管理窗口的左窗格中选择设备管理器。
  4. 在右侧窗格中找到并展开 Android Phone。
  5. 右键单击 Android Composite ADB Interface 并选择更新驱动程序。这将启动硬件更新向导。
  6. 选择从列表或特定位置安装,然后单击下一步。
  7. 选择在这些位置搜索最佳驱动程序;取消选中搜索可移动媒体;并选中在搜索中包含此位置。
  8. 单击浏览并找到 USB 驱动程序文件夹。 (Google USB 驱动程序位于 \extras\google\usb_driver 中。)
  9. 单击下一步升级驱动程序。

回答by spicydog

Before Android Studio, you have to setup Android SDK to your Windows and make ADB work everywhere. However, now life is a lot easier when you use Android Studio since everything includes in it, you just need to enable USB Debugging on your phone and Run.

在使用 Android Studio 之前,您必须将 Android SDK 设置到您的 Windows 并让 ADB 可以在任何地方工作。但是,现在当您使用 Android Studio 时生活会轻松很多,因为它包含所有内容,您只需要在手机上启用 USB 调试并运行即可。

Follow this link: Run on a Real Device

按照此链接:在真实设备上运行

You still doesn't work, try to follow step by step on that page.

你还是不行,试着在那个页面上一步一步来。