在 Eclipse 中处理 Android 应用程序

发布于 2024-12-11 04:10:36 字数 450 浏览 0 评论 0原文

最近开始学习Android开发。 由于我的 PC 上的模拟器速度缓慢且有问题,我尝试将应用程序直接安装到我的设备 HTC Desire S 上。

我的问题:

1:如何正确停止应用程序? (我知道我可以通过 Eclipse 中的设备视图来完成此操作,但应用程序常常会重新启动。)

2:如何在 LogCat 中仅记录一个应用程序? ( com.fd.httpd->HTCSense 进程正在生成大量输出。是的,我可以创建一个新的过滤器,但来自 HTCSense 的日志数量始终在增长,并且在大约 10 000 个日志之后,大约需要 20 秒,我的日志因缓冲区已满而被删除。)

3:我应该如何正确停止我的设备和 Eclipse 之间的连接?我认为“即时”将电缆从设备中拔出并不是最好的解决方案。 (例如,当我使用 Ant 运行 J2ME 项目时,在控制台视图中有“终止”按钮。)

感谢您的回答/建议!

Recently I started to learn Android Development.
Since the emulator is slow and buggy on my PC, I'm trying to install app directly to my device HTC Desire S.

My questions:

1: How can I stop the application properly? ( I know that I can do it via Devices View in Eclipse, but very often the app just start again. )

2: How can I log only one application in LogCat? ( The process com.fd.httpd->HTCSense is generating a TONS of output. Yes I can make a new filter, but the number of logs from HTCSense is always growing and after approximately 10 000 logs, which is matter of 20 seconds, my logs are deleted because of full buffer. )

3: How should I properly stop the connection between my device and Eclipse? Pulling cable out of device "on the fly" is not the best solution I think. ( For example when I run J2ME project with Ant, in Console view there is "Terminate" button. )

Thank you for your answers/recommendations!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦萦几度 2024-12-18 04:10:36
  1. 通常我不会停止该应用程序。我只需按主页按钮或后退按钮,直到到达主屏幕。应用程序的 Activity 将处于 onPause 状态。在Android应用程序中并没有真正关闭。仅当手机内存不足时它们才会关闭。就像你说的,你可以终止该进程。

  2. AFAIK过滤器是限制日志查看的方式。在 ADT 14 中,现在应用程序名称也与日志一起显示。我总是打开过滤器,这样它只会显示我的日志。

  3. 我使用 Windows,因此我单击“安全删除 USB 设备”即可。有时这确实会搞砸 Eclipse 并且我停止接收日志。所以我只是终止 adb 服务器并重新启动它。

这就是我通常做事的方式。

  1. Normally I dont stop the app. I just hit either the home button or the back button until I reach the home screen. The app's activity will be onPause state. In android app's aren't really closed. They are only closed when the phone is low on memory. Like you said, you can kill the process.

  2. AFAIK filter is the way to restrict the view of logs. In ADT 14, now application name is also shown along with the log. I always keep a filter on so it will only show my logs.

  3. I use windows, So in that I click the safely remove USB device and thats it. Sometimes this does screw up eclipse and I stop receiving logs. So I just kill the adb server and start it again.

This is how I normally do things.

小忆控 2024-12-18 04:10:36

1 - 他上面说的。 Android 的工作方式与 Windows 不同,您无法“结束”应用程序/活动(除了强制关闭它),因为您不需要这样做!

2 - 使用 Eclipse 日志过滤器并确保在日志消息中使用标签将它们分开,例如 Log.d("MYAPP","stuff...")
注意:最新的 SDK 更新 (14) 使其更加时髦且更易于使用

3 - 我从不打扰,我只是在想要拿回手机时拔下电缆 - 可能每天 30 次,但我还没有发现问题。
注意:ADB 有时会冻结 - 如果您在连接时遇到问题,请按 Alt-Ctrl-Delete 进入任务管理器并终止它(它通常会自动重新启动 - 如果没有,您可以从 DDMS 启动它)

1 - what he said above. Android doesn't work like Windows, you cannot 'end' an Application/Activity (apart from Force-Closing it) because you do not need to!

2 - Using Eclipse log filters and ensure you use a tag in your Log messages to separate them out e.g. Log.d("MYAPP","stuff...")
Note: The latest SDK update (14) has made this even snazzier and easier to use

3 - I never bother, I just pull the cable when I want my phone back - probably 30 times a day and I've yet to see an issue.
Note: ADB will sometimes freeze - if you're having trouble connecting, Alt-Ctrl-Delete into Task Manager and kill it (it normally restarts automatically - if not you can start it from DDMS)

○闲身 2024-12-18 04:10:36

正如所有其他答案所说,日志就是这样:你需要一个过滤器。

在“调试”视角中,您可以右键单击该进程并选择“终止”来结束它。

拔掉 USB 线就可以了:手机不会在意的。 Eclipse 确实会定期失去理智,但您可以重新启动。

As all the other answers said,the log is what it is: you need a filter.

In the Debug perspective, you can right click on the process and select "Terminate" to end it.

Unplugging the USB cable is fine: the phone won't care. Eclipse does periodically lose its mind, but you can just restart.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文