使用 android maven 插件调试应用程序启动

发布于 2024-12-24 03:44:33 字数 306 浏览 2 评论 0原文

我正在使用最新版本的 android maven 插件。我使用 android:deploy 和 android:run 在我的设备上启动我的应用程序。当我想要调试时,我进入 Eclipse 中的 DDMS 并检查我的应用程序的绿色错误图标。一切工作正常...但我只能调试正在运行的应用程序,即它已经启动。如果我在应用程序构造函数或 onCreate 中放置断点,它不会停止(显然是因为应用程序已启动并且调试尚未激活......)。

所以我的问题是:如何直接从 Maven 以调试模式启动我的应用程序,就像我为从 Eclipse 启动的应用程序所做的那样?

提前谢谢

I'm working with the latest version of android maven plugin. I use android:deploy and android:run to launch my app on my device. When I want to debug, I go into DDMS in eclipse and check the green bug icon for my app. Everything works fine... but I can only debug a running app, ie it has already started. If I put a breakpoint in my application constructor or onCreate, it wont stop (obviously because the application has started and the debugging didn't been activated... yet).

So my question is: how can I start my app in debug mode directly from maven like I would do for an app that I start from eclipse ?

thanks ahead

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

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

发布评论

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

评论(3

煮茶煮酒煮时光 2024-12-31 03:44:33

感谢 Lukasz,我在 Idea 中找到了启动来触发调试模式的命令。
基本上,应用程序是使用 android:deploy 部署的,但我不是使用 android:run,而是使用 -D 启动 shell“am”命令。这是任何有兴趣的人的用法。

ovh-ybi$ adb shell
# am
usage: am [subcommand] [options]

start an Activity: am start [-D] <INTENT>
    -D: enable debugging

send a broadcast Intent: am broadcast <INTENT>

start an Instrumentation: am instrument [flags] <COMPONENT>
    -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
    -e <NAME> <VALUE>: set argument <NAME> to <VALUE>
    -p <FILE>: write profiling data to <FILE>
    -w: wait for instrumentation to finish before returning

start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop

<INTENT> specifications include these flags:
    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
    [-c <CATEGORY> [-c <CATEGORY>] ...]
    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
    [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
    [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
    [-n <COMPONENT>] [-f <FLAGS>] [<URI>]

Thanks to Lukasz, I found the command in Idea that is launched to trigger the debug mode.
Basically, the application is deployed with android:deploy but instead of android:run, I launch a shell "am" command with -D. Here's the usage for anyone interested.

ovh-ybi$ adb shell
# am
usage: am [subcommand] [options]

start an Activity: am start [-D] <INTENT>
    -D: enable debugging

send a broadcast Intent: am broadcast <INTENT>

start an Instrumentation: am instrument [flags] <COMPONENT>
    -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
    -e <NAME> <VALUE>: set argument <NAME> to <VALUE>
    -p <FILE>: write profiling data to <FILE>
    -w: wait for instrumentation to finish before returning

start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop

<INTENT> specifications include these flags:
    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
    [-c <CATEGORY> [-c <CATEGORY>] ...]
    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
    [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
    [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
    [-n <COMPONENT>] [-f <FLAGS>] [<URI>]
你穿错了嫁妆 2024-12-31 03:44:33

您可以通过 eclipse 而不是通过 maven 在调试中启动应用程序,而不是 android:deploy 和 android:run 。您必须正确配置您的项目才能执行此操作。

Instead of android:deploy and android:run you could just launch your application in debug by eclipse and not by maven. You have to have your project configured properly to do this.

那些过往 2024-12-31 03:44:33

您可以使用这篇文章部署并启动它。为了调试我想并希望你只需要更改一些参数。

You can deploy and start it using this post. To debug I guess and hope you only need to change some parameters.

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