Eclipse 没有第二次在模拟器上运行 Android 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8290879/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:22:22  来源:igfitidea点击:

Eclipse not running Android app on emulator a second time

androideclipse

提问by Vici37

I've decided to teach myself how to program android apps, and so got the ADT onto eclipse and going through the tutorials on the android development page. I've run into a problem where eclipse doesn't launch the emulator to run the app a second time.

我决定自学如何编写 android 应用程序,因此将 ADT 放到了 eclipse 中并阅读了 android 开发页面上的教程。我遇到了一个问题,即 eclipse 没有启动模拟器来第二次运行应用程序。

I first noticed the problem on the second tutorial talking about different layouts for an app. I'm able to run the app just fine the first time, the emulator pops up and I see the layout that I'm testing. I then close the emulator, make a small change (or no change at all), run it again, and eclipse gets stuck in "launching delegate" part. In the bottom right hand corner it states that it's loaded to 27%, but then nothing happens. My CPU isn't being taken up by any processes that you'd expect with it launching an emulator. I've tried canceling the launch but then that just gets the new title of "canceling launch" and still nothing happens. If I close and reopen eclipse, I'm able to launch like normal again, but then the second try it does the same thing.

我首先注意到第二个教程中讨论应用程序不同布局的问题。我第一次可以很好地运行应用程序,模拟器弹出,我看到了我正在测试的布局。然后我关闭模拟器,做一个小的改变(或根本没有改变),再次运行它,eclipse 卡在“启动委托”部分。在右下角,它指出它已加载到 27%,但随后什么也没有发生。我的 CPU 没有被您期望启动模拟器的任何进程占用。我试过取消发射,但后来只是获得了“取消发射”的新标题,但仍然没有任何反应。如果我关闭并重新打开 eclipse,我可以再次像平常一样启动,但是第二次尝试它会做同样的事情。

I then went back to the first tutorial ("Hello Android!") and found the problem exists there as well. I've tried killing and restarting the server in adb and that didn't help.

然后我回到第一个教程(“Hello Android!”),发现那里也存在问题。我试过在 adb 中杀死并重新启动服务器,但没有帮助。

I'm emulating for android 2.2 froyo on windows xp in eclipse. I have java JDK 6u29 installed.

我正在 eclipse 中的 windows xp 上模拟 android 2.2 froyo。我安装了 java JDK 6u29。

UPDATE:

更新:

Rerunning the app in the emulator without closing said emulator doesn't work - progress bar still loads and stops at 27% with no change afterwards.

在不关闭所述模拟器的情况下在模拟器中重新运行应用程序不起作用 - 进度条仍然加载并在 27% 处停止,之后没有任何变化。

UPDATE 2:

更新 2:

Problem not solved, but found a work around by just keeping the emulator running.

问题没有解决,但通过保持模拟器运行找到了解决方法。

采纳答案by Narendran Srinivasan

Team,

团队,

Found some solution for this, hope it helps

找到了一些解决方案,希望它有所帮助

  1. Start the eclipse
  2. Go to Windows->AVD manager-> select the Virtual device -> click start
  3. Right click the project -> select run as-> run configuration and the same virtual device
  4. Your application should load now
  5. Dont close the emulator, you can make changes to the code and follow the 3rd step
  1. 开始日食
  2. 转到 Windows->AVD 管理器-> 选择虚拟设备 -> 单击开始
  3. 右键项目->选择运行方式->运行配置和同一个虚拟设备
  4. 您的应用程序应该立即加载
  5. 不要关闭模拟器,您可以更改代码并按照第 3 步操作

Till now i don't have problem with this method, any thoughts would be highly appreciated

直到现在我对这种方法没有问题,任何想法将不胜感激

回答by shebik

I think I have found a solution.

我想我已经找到了解决办法。

right click on your project -> Run As -> Run Configurations -> Common -> uncheck "Launch in background"

右键单击您的项目 -> 运行方式 -> 运行配置 -> 通用 -> 取消选中“在后台启动”

At least, it works for me:)

至少,它对我有用:)

回答by Paul Beusterien

I ran into a related but different problem today. I created an emulator with snapshot enabled for the first time. I was no longer able to run apps for a second time from "Run As".

我今天遇到了一个相关但不同的问题。我第一次创建了一个启用快照的模拟器。我不再能够从“运行方式”中第二次运行应用程序。

The workaround was to launch the AVD from the AVD manager instead of the first "Run As" invocation.

解决方法是从 AVD 管理器启动 AVD,而不是第一次“运行方式”调用。

回答by Davut CANLI

I havent read all of the comments yet I had the same problem and solved it. The only thing that I did was to launch the AVD manager and click the AVD that you've already created before, then click start button. Once again, please do these steps before running your program as an android app. Hope it works ...

我还没有阅读所有评论,但我遇到了同样的问题并解决了它。我所做的唯一一件事就是启动 AVD 管理器并单击您之前已经创建的 AVD,然后单击开始按钮。再一次,请在将您的程序作为 Android 应用程序运行之前执行这些步骤。希望它有效...

回答by Aaron

I don't know if you still have this problem. I was having the same problem. On the upper right hand side it had DDMS instead of Java. Once I switched it to Java it worked. I had to change it to Java EE first then Java. I have not idea why it works that way, but it works

不知道你还有没有这个问题。我遇到了同样的问题。在右上角,它有 DDMS 而不是 Java。一旦我将它切换到 Java,它就起作用了。我必须先将其更改为 Java EE,然后再将其更改为 Java。我不知道为什么它会这样,但它确实有效

回答by DJ7

I too had a very similar problem. I have observed that this problem surfaced when I changed Android version that my app is supposed build against is changed (from 2.2 to 4.3 or vice-verse) after the emulator is up.

我也有一个非常相似的问题。我已经观察到,当我更改 Android 版本时,这个问题就出现了,我的应用程序应该在模拟器启动后更改(从 2.2 到 4.3 或反之亦然)。

To recover I had to terminate eclipse (make sure eclipse and emulator are not running in task manager) and start all over again.

为了恢复,我不得不终止 eclipse(确保 eclipse 和模拟器没有在任务管理器中运行)并重新开始。

回答by Amos M. Carpenter

This might be grasping at straws as it's hard to say exactly what's causing your problem, but have you had a look at this question and its answer?

这可能是在抓住稻草,因为很难确切地说出导致您问题的原因,但是您是否看过这个问题及其答案

If not I hope the workaround with re-deploying once it's up and running is good enough :-)

如果没有,我希望一旦它启动并运行就重新部署的解决方法足够好:-)