Eclipse 不会自动切换运行配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6765351/
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
Eclipse not automatically switching run configurations
提问by trevor-e
Everything was working fine yesterday. I start to work on my project today and Eclipse gives me a bunch of problems. First, it wouldn't let me debug saying "Cannot connect to vm". I don't exactly remember how I fixed that problem, but I did. I was able to debug once again. I just recently created a new project to test something separate from my main project and now Eclipse is giving me some more problems. This time it is saying "An internal error occurred during: "Launching New_configuration". Path for project must have only one segment."
昨天一切正常。我今天开始处理我的项目,Eclipse 给了我一堆问题。首先,它不会让我调试说“无法连接到 vm”。我不记得我是如何解决这个问题的,但我确实记得。我能够再次调试。我最近刚刚创建了一个新项目来测试与我的主项目分开的东西,现在 Eclipse 给我带来了更多问题。这次是说“在:“启动New_configuration”期间发生内部错误。项目路径必须只有一个段。”
After some searching, I found that it is related to the debug configurations. In order to debug a project now I have to go to Run->Run Configurations and select the project I want to debug. Before, it would automatically do this for me. I would just select a java file from a project and it would debug the project that contained the file. Also, I can't find my new project in the list of Android Applications under Run->Run Configurations. I've tried creating a new one in the menu, but when specifying a source it can't find my project folder even though it is clearly open in Eclipse. Eclipse has been giving me massive headaches lately and I don't understand what could have caused this to happen. Eclipse was left open all night and the computer doesn't go into sleep mode (sorry for wasting power!).
经过一番搜索,我发现它与调试配置有关。现在为了调试项目,我必须转到运行->运行配置并选择我要调试的项目。以前,它会自动为我执行此操作。我只会从项目中选择一个 java 文件,它会调试包含该文件的项目。另外,我在运行->运行配置下的Android应用程序列表中找不到我的新项目。我试过在菜单中创建一个新的,但是当指定一个源时,它找不到我的项目文件夹,即使它在 Eclipse 中明显打开。Eclipse 最近让我很头疼,我不明白是什么导致了这种情况的发生。Eclipse 整晚都处于打开状态,计算机没有进入睡眠模式(抱歉浪费电源!)。
Any ideas on how to get it to see my project and make it automatically debug the right project?
关于如何让它看到我的项目并使其自动调试正确的项目的任何想法?
回答by VonC
What is the usual case (detailed below as a Run or Debug configuration with no project name) wasn't the root cause:
通常的情况(下面详细描述为没有项目名称的运行或调试配置)不是根本原因:
In the comments, I suggested:
在评论中,我建议:
Did you try to import this existing project in a brand new workspace? (to see if this isn't related to some kind of workspace metadata corruption?)
您是否尝试在全新的工作区中导入此现有项目?(看看这是否与某种工作区元数据损坏无关?)
To which the OP Atlosreplied:
为了使OP Atlos回答:
creating a new workspace seemed to have fixed it. Not sure what could have happened to my old workspace to cause a problem like this.
Should I ditch my old workspace and just import stuff into the new one?
创建一个新的工作区似乎已经修复了它。不确定我的旧工作区会发生什么导致这样的问题。
我应该放弃我的旧工作区并只将内容导入新工作区吗?
It happens, and can be caused by some process blocking the update of metadata, rendering parts of the workspace unsound.
It is perfectly OK in that case to save/move that old workspace (for reference just in case) and to create a brand new one.
它发生了,并且可能是由于某些进程阻止元数据更新,导致工作区的某些部分不健全而引起的。
在这种情况下,保存/移动旧工作区(以防万一)并创建一个全新的工作区是完全可以的。
This blog postmentions:
这篇博文提到:
It seems that this rather cryptic message means nothing more in my case than “please enter a name and project for your run configuration”.
I did have a “name”, but left the “Project” field empty. Entering a value in the ‘project' (the “AndroBlip” you see next to ‘browse') fixed it.
Sources seem to indicate that the same error is produced if you don't enter a value in the ‘name'-field.
似乎这个相当神秘的消息在我的情况下仅意味着“请为您的运行配置输入名称和项目”。
我确实有一个“名称”,但将“项目”字段留空。在“项目”中输入一个值(您在“浏览”旁边看到的“AndroBlip”)修复了它。
来源似乎表明,如果您不在“名称”字段中输入值,则会产生相同的错误。
It actually references the similar SO question "Android: “Path for project must have only one segment”".
它实际上引用了类似的 SO 问题“ Android:“项目路径必须只有一个段”。
Note that you would see the same error for trying to have a project within another project (as detailed in this thread).
请注意,尝试在另一个项目中创建一个项目时,您会看到相同的错误(如本主题所述)。