问题
I'm a noob to Java, Eclipse and Android application development. I'm going through the Android app tutorial but can't seem to get the first lesson to launch on my device. After fixing a handful of issue preventing the project from compiling I was able to get it to run on an AVD. But have had no luck on a physical device. The following are the details of my environment and what the console shows me.
On the phone I tried looking for the install under apps, downloads and the desktop but don't see it.
Computer: Windows XP
Device: Samsung Galaxy Nexus running 4.1, kernel 3.036-04142-gfa7dc12-dirty
Dev Env: Eclipse Juno
Console:
[2012-07-10 13:35:11 - MyFirstProject] ------------------------------
[2012-07-10 13:35:11 - MyFirstProject] Android Launch!
[2012-07-10 13:35:11 - MyFirstProject] adb is running normally.
[2012-07-10 13:35:11 - MyFirstProject] Performing com.example.myfirstapp.MainActivity activity launch
[2012-07-10 13:35:14 - MyFirstProject] Uploading MyFirstProject.apk onto device '014994321500300C'
[2012-07-10 13:35:14 - MyFirstProject] Installing MyFirstProject.apk...
[2012-07-10 13:35:14 - MyFirstProject] Success!
[2012-07-10 13:35:14 - MyFirstProject] Starting activity com.example.myfirstapp.MainActivity on device 014994321500300C
Thanks for the quick responses.
My phone is visible from Eclipse when debugging. I hadn't specifically installed the Samsung driver on the machine I'm doing this on. Checking Device Manager I saw the phone was not recognized properly by Windows. I have since installed the driver and can now perform actions on the phone through the command prompt (e.g. adb reboot).
After installing the driver I rebooted my pc and phone. Unfortunately the default intent still does not load on the phone as it does when using an AVD. I'd be happy using the AVD but it is pretty slow on my pc plus it's just cooler to hold it in your hands (it's more real). :)
回答1:
For google Nexus devices you should download Google USB Driver from here: http://developer.android.com/sdk/win-usb.html After installing this(from android sdk manager) just restart eclipse and it should recognize and install the apk on your physical device
回答2:
Check in DDMS perspective of eclipse ADT if your device is listed or use adb devices command to check that from console. From the logs it seems to find the device and install properly so that is most likely not the issue.
In debug perspective go to preferences and select the break on exception options and start the app in debug mode. This link shows how to configure eclipse:
Break when exception is thrown
You will then be able to inspect the error your app fails on. Alternative option is to check logcat for errors.
回答3:
i think your problem with configration with ADT plugins and also you have to install related SDK updated version. be specific to select Emulator version as per your application.
take new eclipse version and SDK from below link
http://developer.android.com/sdk/index.html
take Android 4.2 API
http://developer.android.com/about/versions/android-4.2.html
回答4:
The other answers here are not true and flat out not helpful. I was in this exact situation, and its always caused because of a silly mistake. Check your manifest! If your manifest is blank, or there is no application, or launcher activity then Android will not have any clue about how to launch your activity and hence will not show a launcher icon!
Unfortunately, there is no stack trace AND your application will show up in the application manager as being installed.
I ran into this problem myself when switching up gradle configurations. I accidently didn't load in my Manifest which I use to merge over a blank manifest.
来源:https://stackoverflow.com/questions/11418949/app-will-not-launch-on-device