“运行方式 -> Android 应用程序”不再是我的 Eclipse 运行配置中的一个选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10857870/
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
The "Run As -> Android Application" is no longer an option in my Eclipse Run Configuration
提问by Joe C
I'm running Eclipse 3.7.2 on a Win7 machine. I have the Android SDK and AVD. All was working well. I have an Android App project that I've run under the emulator on an AVD and on a real Android device. ADB worked fine as well.
我在 Win7 机器上运行 Eclipse 3.7.2。我有 Android SDK 和 AVD。一切都运行良好。我有一个 Android 应用程序项目,我在 AVD 和真正的 Android 设备上的模拟器下运行。亚行也工作得很好。
At some point I grabbed SDK Android 4.0.3. Then I had to upgrade a few more things that I cannot remember, perhaps my AVD. But ever since this upgrade there is no option to run my package as an Android Application anymore. If I choose "Run" it throws up a menu asking me to select a way to run it and "Android Application" is not a choice. It has to be Java App, etc. If I open "Run Configurations" there is no "Android Application" in my left column.
在某些时候,我抓住了 SDK Android 4.0.3。然后我不得不升级一些我不记得的东西,也许是我的 AVD。但是自从这次升级之后,就再也没有选项可以将我的包作为 Android 应用程序运行了。如果我选择“运行”,它会弹出一个菜单,要求我选择一种运行它的方式,而“Android 应用程序”不是一个选择。它必须是 Java 应用程序等。如果我打开“运行配置”,则左栏中没有“Android 应用程序”。
My SDK manager still lists Android 4.0 and Android 4.0.3 as "Installed." My AVD Manager still let's me launch an Android virtual device and even create a new one. But Eclipse does not let me run my package as an Android Application.
我的 SDK 管理器仍然将 Android 4.0 和 Android 4.0.3 列为“已安装”。我的 AVD 管理器仍然让我启动一个 Android 虚拟设备,甚至创建一个新的。但是 Eclipse 不允许我将我的包作为 Android 应用程序运行。
回答by MandisaW
Make sure you check for updates to the Android ADT plug-in for Eclipse in addition to upgrades for the AVDs, SDKs, and other debug tools. Then make sure you're in your Android perspective (upper left of Eclipse window), rather than some other/generic Java perspective (no Android-specific options).
除了 AVD、SDK 和其他调试工具的升级之外,请确保检查 Eclipse 的 Android ADT 插件的更新。然后确保您处于 Android 透视图(Eclipse 窗口的左上方),而不是其他/通用 Java 透视图(没有特定于 Android 的选项)。
Also, you can check under Window > Customize Perspective... in Eclipse to double-check that all the Android options (menus, context items, views, toolbars) you want are enabled.
此外,您可以在 Eclipse 中的 Window > Customize Perspective... 下检查以仔细检查您想要的所有 Android 选项(菜单、上下文项、视图、工具栏)是否已启用。
UPDATE: You can add the Android tools to any perspective (I named mine "Android"). From the DDMS or Java perspective, go to Window > Customize Perspective - DDMS. Click the Command Groups Availability tab, and make sure that "Launch" is checked.
更新:您可以将 Android 工具添加到任何透视图(我将我的工具命名为“Android”)。从 DDMS 或 Java 角度,转到窗口 > 自定义透视图 - DDMS。单击命令组可用性选项卡,并确保选中“启动”。
Also go to Project > Properties > Run/Debug Settings and check that there is a Launch Configuration listed. Create/Edit that configuration and confirm that it has an Android tab (usually set to run the Default Activity from your Manifest).
还要转到项目 > 属性 > 运行/调试设置并检查是否列出了启动配置。创建/编辑该配置并确认它有一个 Android 选项卡(通常设置为运行清单中的默认活动)。
If not, there may be something wrong with your project's association - try right-clicking on your Project in Project Explorer, go to Android tools (if available) > Fix Project Properties. I believe there's an Ant tool that can do this from the command-line, but you'd have to check the Android/Google docs.
如果没有,您的项目关联可能有问题 - 尝试在项目资源管理器中右键单击您的项目,转到 Android 工具(如果可用)> 修复项目属性。我相信有一个 Ant 工具可以从命令行执行此操作,但您必须查看 Android/Google 文档。
There's also the possibility that something's off with your Eclipse installation or that you've got a newer ADT plug-in than your version of Eclipse. Eclipse Juno (v4.2) released at the end of June, and the most recent ADT plug-in may be looking for something that's not there in your v3.7 install.
也有可能您的 Eclipse 安装出现问题,或者您的 ADT 插件比您的 Eclipse 版本更新。Eclipse Juno (v4.2) 于 6 月底发布,最新的 ADT 插件可能正在寻找 v3.7 安装中没有的东西。
回答by Levite
What fixed it for me was:
为我修复的是:
- Right-clicking on the Project Name in the
Package Explorer
Android Tools
->Fix Project Properties
- 右键单击项目名称中的
Package Explorer
Android Tools
->Fix Project Properties
After that I was able to just Click Run As -> Android Application and all was well for me
之后我就可以点击 Run As -> Android Application,一切都对我来说很好
回答by user6879602
Click mouse right button on your project -> Configure -> Convert ADT Android Configuration
在您的项目上单击鼠标右键 -> 配置 -> 转换 ADT Android 配置
回答by Jean-Pierre Schnyder
An easy fix is to manually create an android run configuration:
一个简单的解决方法是手动创建一个 android 运行配置:
Run / Run configurations..., then right click on "Android application" and select new, select your project and click Run.
运行/运行配置...,然后右键单击“Android 应用程序”并选择新建,选择您的项目并单击运行。
回答by GothamNite
I had a similar problem. What I finally did that worked was go into Project->Properties->Java Build Path->Order and Export and I made sure that the /gen files we're first in the sequence followed by the /src files.
我有一个类似的问题。我最终所做的工作是进入 Project->Properties->Java Build Path->Order and Export,我确保 /gen 文件在序列中排在第一位,然后是 /src 文件。