eclipse 应用程序不会在设备上启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11418949/
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
app will not launch on device
提问by Scott
I'm a noob to Java, Eclipse and Android application development. I'm going through the Android app tutorialbut 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.
我是 Java、Eclipse 和 Android 应用程序开发的菜鸟。我正在学习Android 应用教程,但似乎无法在我的设备上启动第一堂课。在修复了一些阻止项目编译的问题后,我能够让它在 AVD 上运行。但是在物理设备上没有运气。以下是我的环境的详细信息以及控制台向我显示的内容。
On the phone I tried looking for the install under apps, downloads and the desktop but don't see it.
在手机上,我尝试在应用程序、下载和桌面下寻找安装,但没有看到。
Computer: Windows XP
计算机:Windows XP
Device: Samsung Galaxy Nexus running 4.1, kernel 3.036-04142-gfa7dc12-dirty
设备:三星 Galaxy Nexus 运行 4.1,内核 3.036-04142-gfa7dc12-dirty
Dev Env: Eclipse Juno
开发环境: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).
调试时可以从 Eclipse 中看到我的手机。我没有在我正在执行此操作的机器上专门安装三星驱动程序。检查设备管理器我看到手机没有被 Windows 正确识别。我已经安装了驱动程序,现在可以通过命令提示符(例如 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). :)
安装驱动程序后,我重新启动了我的电脑和手机。不幸的是,默认意图仍然不会像使用 AVD 时那样加载到手机上。我很乐意使用 AVD,但它在我的电脑上很慢,而且把它拿在手里更酷(它更真实)。:)
回答by simas
For google Nexus devices you should download Google USB Driver from here: http://developer.android.com/sdk/win-usb.htmlAfter installing this(from android sdk manager) just restart eclipse and it should recognize and install the apk on your physical device
对于谷歌 Nexus 设备,你应该从这里下载谷歌 USB 驱动程序:http: //developer.android.com/sdk/win-usb.html安装后(从 android sdk 管理器)只需重新启动 eclipse,它应该识别并安装 apk在您的物理设备上
回答by stevebot
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!
这里的其他答案不正确,完全没有帮助。我正是在这种情况下,它总是由于一个愚蠢的错误引起的。检查您的清单!如果您的清单是空白的,或者没有应用程序或启动器活动,那么 Android 将不知道如何启动您的活动,因此不会显示启动器图标!
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.
我自己在切换 gradle 配置时遇到了这个问题。我不小心没有加载我用来合并空白清单的清单。
回答by hcpl
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.
如果您的设备已列出,请检查 Eclipse ADT 的 DDMS 透视图,或者使用 adb devices 命令从控制台进行检查。从日志中它似乎找到了设备并正确安装,所以这很可能不是问题。
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:
在调试角度转到首选项并选择中断异常选项并以调试模式启动应用程序。此链接显示了如何配置 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.
然后,您将能够检查您的应用程序失败的错误。另一种选择是检查 logcat 是否有错误。
回答by umang shukla
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.
我认为您的 ADT 插件配置问题,并且您必须安装相关的 SDK 更新版本。特定于根据您的应用程序选择模拟器版本。
take new eclipse version and SDK from below link
从下面的链接获取新的 Eclipse 版本和 SDK
http://developer.android.com/sdk/index.html
http://developer.android.com/sdk/index.html
take Android 4.2 API
使用 Android 4.2 API
http://developer.android.com/about/versions/android-4.2.html
http://developer.android.com/about/versions/android-4.2.html