Why does eclipse SOMETIMES prompt me which device to launch my app on when there is only 1 phone connected to my machine? Sometim开发者_运维技巧es, it stays like this for months.... how to fix?
It says my target phone is 2.3.4 and there is a small yellow exclamation warning next to it.
Its because your application Target mode has set to manual. To solve :
Right Click on your project-> Run as -> Select Run Configurations ->
In that select Target Tab ->Select Automatic instead of manual
Click on Apply and run.
Now your app doesn't prompt for a device.
For a reverse case Select Manual.
Hope it helps.
Run -> Run Configurations -> Choose current project in the list on the left -> Target -> Automatic
This will run the application automatically on a connected device. However, don't know how will it work if there are more then one device connected.
I don't know why it happens (it drives me mad too) but I find you can cure it by disconnecting and then reconnecting the phone.
Do Like this: Right Click on Your Project Name -> Run As -> Run Configurations.. -> then select target And then select Automatic Mode.
I suspect you are having this issue: http://code.google.com/p/android/issues/detail?id=11373 I have this problem too, and I noticed it when I switched my phone to a CM7.1 nightly. I don't know how the ADT detects "device compatibility," but clearly it doesn't work that well.
In theory it should only appear if you are using the Google API target. If you don't actually need them, you could switch to the standard API target.
I usually just restart the adb...I sometimes have to do this with the adb as it will automagically disconnect sometimes for me and my device that it sees is now inactive. I hate having to disconnect and reconnect the device. I know its not a complete answer but what you are seeking for is a solution to software bugs that Google and/or Eclipse community needs to fix.
ADB restart solution
Sometimes it is because your minSDKVersion is too high for your phone that's why it is not working.
If you are on Linux, and you want to remove the yellow marker do the following :
- Quit Eclipse
- With terminal go in the platform-tools folder
- Do sudo ./adb kill-server
- Disable the development debug on your phone
- Enable it again
- Do sudo ./adb start-server
It is supposed to fix it!
To check if your device is enabled ./adb devices
Your phone has to appeared with Online state as a return!
fix like this:
right click on your project->Run As->Run Configuration
there select target and select automatic and specify the VD there..
This is beacuse you have not set the Right target Device for your App. Follow the Instructions Goto Run Configuration Select Target Device Select the AVD Click on Apply> Thats it
It happens to me too sometimes. When it happens,
- I remove the usb cable
- then I disable usb debugging from the phone properties
- I reenable usb debugging and replug usb cable
- run the android application from eclipse, it shoud directly run on the phone
This appears to happen whenever the windows driver unloads and communication with ADB ceases. The exact cause could be anything in the chain which crashes the driver: Eclipse ADT, ADB, USB, Android ... take your pick.
As others have pointed out, replugging the device works though inconvenient and annoying.
If the version and auto-detect solutions outlined in the preceeding answers don't provide any joy then it may be worth taking trying out some mitigating measures such as:
Enable the "Stay Awake" option in Application->Development if you have this available.
Install the latest versions of the eclipse ADT plugins and ADB, plus any vendor specific drivers (in my case via Samsung Kies).
If this is really bad then you could take the drastic measure of using a different USB port. Some of my laptop's USB ports have become a little grizzly in their old age and don't always play fair.
Beyond this try upgrading the formware on your device.
I really don't know what more you can try other than a soothing cup of tea whenever it happens or taking up meditation.
Right click on your project -> Run As -> Run Configurations
From there navigate to Target, select "Launch on all compatible devices/AVD's", and choose "Active devices" from the dropdown.
(the 'automatic' option is not, in fact, automatic from the perspective of the user)
There is another possible explanation for this problem.
On recent versions of Eclipse there is a checkbox "Use same device for future launches" on the "Android Device Chooser" panel. If this is checked, then it overrules the Run Configurations setting "Always prompt to pick device".
If you suspect this may be causing your problems, shut down the device and re-launch with the checkbox unticked.
精彩评论