How to connect the device to Eclipse?

2020-01-28 08:54发布

问题:

I am not able to resolve this simple issue.

I am trying to connect my device to Eclipse via USB cable.
On my PC, I have installed Eclipse and the Android SDK and running the program on the emulator is working fine.

I have downloaded and installed Samsung Kies on my PC. It shows my device if connected via USB to the PC.

But I dont know how to connect the device with the emulator.

Connect means, I want to run the Eclipse code on my device instead of emulator. I am using Samsung Galaxy Ace GT-S5830i. Please help me out to resolve this issue.

回答1:

Comment is lack of formatting so i add an answer.

  1. Check if your computer had your phone driver. I assume that your use Windows. Open Device Manager

    • At a command prompt, in the Start Search box, or in the Run box, type the following command: mmc devmgmt.msc

    • . Other ways : check link

    If you find your phone name or ADB Interface so you got driver. Try to restart DDMS or restart your Eclipse.

  2. If you don't find your device or see something Other device with yellow question mark so try to install driver by browsing on your phone to Settings - Developer Options - Enable developer option - Enable USB debugging - Plug your phone to computer. Windows will ask you to install driver.

3, Update Google USB driver in Android SDK Manager (in Eclipse) or search Samsung Galaxy Ace GT-S5830i driver

4.Some weird case i got on some device.

  • Nexus S: disable Developer option. Restart phone. Enable again. Windows ask to install driver or you will see it in Eclipse.
  • HTC phone or Samsung : change Connectivity Option on phone to Charge only (Swipe status bar. Check notifications displayed). Some phone set it to some kind of Sync data so Windows can not recognize device.


回答2:

I think your emulator is in Automatic. You can change that to Manual.

Try this,

Step 1

Go to Run Configuration

You can see three Columns Android,Target and Common.

Step2

Select the Target

Step 3

Choose Always prompt to pick device.Click Ok

Step 4

Now run your project you should see the emulator and your device. Select your device and click ok.

Hope it helps.



回答3:

Source.

Troubleshooting
This all sounds very straightforward, but there are countless quirks and hard-to-diagnose problems that can make connecting a device much more difficult than it sounds. In this section, we'll run through a checklist of things to try when your device isn't registering.

  1. Check that USB Debugging is enabled. This setting can inadvertently (and perhaps even automatically) change when you plug/unplug your device from your machine, or when you reboot your phone.

  2. Check your device while it's connected to your machine. Is it asking you to choose between different modes? Some phones have a 'charge only' mode that can prevent Eclipse from recognizing the device.

Choose a connection type

  1. Make sure you don't have an Android Virtual Device running in the background.

  2. Could there be a problem with the USB cable? If you have a spare cable to hand, plug it in to rule out a fault with the cable itself.

  3. Double-check you're running the correct driver. Even if you are, some devices have all the required software pre-installed (for example, HTC Sync) and downloading drivers from another location can muddy the waters. If this might be the case with your device, try uninstalling the driver from your machine and reinstalling the software from your device's memory.

  4. Does the driver require supporting software? Samsung Kies on Windows requires .Net Framework 3.5 SP1 or above, for example. This is usually installed along with the driver, but there's no guarantee.

  5. Running the Android Debug Monitor tool (monitor.bat) has been known to kickstart Eclipse into recognizing a new device. Connect your device, locate monitor.bat (android-sdks/tools/monitor.bat) and double-click to open. This will open the Android Debug Monitor, a stand-alone debugging tool that lists connected devices.

Android Debug Monitor

  1. A running adb.exe process can interfere with the connection. Close Eclipse, and open the Task Manager by pressing CTRL, Shift and Esc. Find the adb.exe process and kill it. Launch Eclipse and try again.

  2. Check that your 'Project Build Target' is compatible with the Android version on your device. You can check what version of Android your device is running by opening 'Settings' and selecting 'About Phone,' followed by the 'Software information' option if available. If you need a reminder of your project's build target, ensure the project is selected in Eclipse's 'Package Explorer,' open the 'Project' menu and select 'Properties.' If the 'Android' tab isn't selected by default, open it and the Build Target will be displayed.



回答4:

Have you enabled USB debugging in your device?? You can find it in your device

Settings -> Developer Options -> USB Debugging.


回答5:

The android app you have created will be a .apk file, generated by eclipse, during a successful Run. Find the .apk file from the eclipse project explorer or by tracing your workspace. Copy the .apk file to your memory card (via USB or a card reader) and install it.

You should also enable the "Unknown Sources" option under "Security" of your Android device.



回答6:

If you have required options enabled on your phone (USB Debugging and Unknown Sources) you can try do this. On your computer open command console. Using cd navigate to your android sdk installation folder. Go to platform-tools. You should have there adb file. Run this

./adb kill-server

and then

./adb start-server

Then check plugged devices

./adb devices


回答7:

First, you are not connecting device with emulator. What you want is eclipse to identify your device and use it for development.

Everything about using devices for android development is given in official documentation.



回答8:

You have to put the phone in 'debug' mode - I don't have the instructions handy (but you can search here or on the android site for the info you need).

Also check for THIS.



回答9:

Try right clicking the project -->Run As --> Run Configurations then select target and choose always prompt On your device turn on debug mode Now try running project



回答10:

I am assuming you don't mean connecting the device with the emulator but connecting the device to your computer so you can debug it and run applications directly from Eclipse to the device. In which case KIES by Samsung will not help you at all. What you need is the Android USB Drivers provided in the Extras tab in SDK. Sometimes the installation will bug up because you didn't run SDK manager as an administrator so make sure you do that. When all of this is done make sure your device is unconnected to your computer and then reconnect it after the drivers are installed. You should be prompted with a new device installation wizard which you must accept. Additionally, you should have debugging enabled on your device, and as an extra step you can setup launching as a manual configuration but it is not needed.

To enable device debugging

Settings -> Developer Options -> USB Debugging.

For more information visit here

BTW : If the Google USB Drivers don't work you might need to install the specific Samsung drivers which are located here



回答11:

Goto -> Setting -> Application -> Development -> USB Debugging

Enable it and try.



回答12:

I know this is a little old, but I was having the same issue. I tried all the options of setting usb debugging (off), disconnecting, restarting phone, usb debugging (on), connecting the phone and it just wouldn't connect.

I ended up installing the latest version of Kies on my machine and added the Unified option at the end of the installer and I then the phone would connect. (Not sure i needed the unified option) but it worked for me.



回答13:

I tried all the above but it didn't helped me. I did couple of things additionally

  1. Since my mobile device is Android, I unchecked Unified option from Kies installer. This is the crucial thing that helped me solve my problem
  2. I restarted my mobile phone.