如何调试建成使用Maven Android应用 [英] How to debug android application built with maven

查看:275
本文介绍了如何调试建成使用Maven Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我试图从月食我的设备上调试Android应用程序。

I'm currently trying to debug android application on my device from eclipse.

设备已添加我可以看到它无论是在控制台和月食。控制台(Windows)中:

Device has been added I can see it both in console and in eclipse. Console (Windows) :

adb devices
List of devices attached
0019cca27f2e6e  device

和Eclipse:

And the eclipse :

我可以不用这两种设备/模拟器上的任何问题,运行应用程序。我只是做全新安装安卓部署然后按安卓跑和工程就像一个魅力。但我无法弄清楚如何尚未调试它。

I can run the app without any issues on both device/simulator. I just do clean install and android:deploy followed by android:run and works like a charm. But I can't figure out yet how to debug it.

但是当我真正的设备(三星GALAXY SII)上运行的应用程序,我只能看到这两个过程执行 com.viber.voip com.viber.voip:keepAliveReceiver 我看不到我的应用程序,即使我运行它。然而在模拟器/仿真器,我可以看到我的应用程序的运行。

But when I actually run the app on the device(Samsung galaxy SII) I can only see these two processes executing com.viber.voip and com.viber.voip:keepAliveReceiver I don't see my app even if I run it. However on the simulator/emulator I can see my app running.

我已经走了低谷这种材料:

I've gone trough this material:

<一个href="http://stackoverflow.com/questions/8679078/debugging-an-app-startup-with-android-maven-plugin">debugging一个应用程序的启动与And​​roid Maven插件

<一个href="http://stackoverflow.com/questions/6360103/how-to-start-application-in-command-line-with-maven">How要开始使用Maven 的命令行应用程序

<一个href="http://$c$c.google.com/p/maven-android-plugin/wiki/Debug">http://$c$c.google.com/p/maven-android-plugin/wiki/Debug

不能突破code。即使试图与的maven-EXEC-插件通过调用脚本下面开始调试,这里是该插件在POM:

Can't break the code. Even tried with maven-exec-plugin to start debugging by calling the script underneath, here is that plugin in pom :

<plugin>
            <artifactId>exec-maven-plugin</artifactId>
        <groupId>org.codehaus.mojo</groupId>
        <configuration>
            <executable>${basedir}/scripts/debug_app.cmd</executable>
        </configuration>
</plugin>

中的内容 debug_app.cmd

adb shell am start -D android.intent.action.MAIN -n my.package.name/.HelloAndroidActivity

当我执行这个插件,我得到了以下错误:

When I execute this plugin I get the following ERROR :

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=android.intent.action.MAIN }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=android.intent.action.MAIN }

下面是我的的manifest.xml 如果是需要:

Here is my manifest.xml if that is needed :

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.SET_DEBUG_APP" >
</uses-permission>

<!-- <uses-permission android:name="android.permission.INTERNET" /> -->

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <activity android:name=".HelloAndroidActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".DisplayMessageActivity" >
    </activity>
</application>

有没有人管理使用Maven构建应用程序的设备调试?

Has anyone manage to debug the device using maven to build the app?

问题的更新:

在加入机器人:可调试=真正的我的应用程序出现在设备选项卡上,但我遇到不同的问题(当我点击的绿色调试图标的下面)。

After adding the android:debuggable="true" my app appeared on the devices tab, but I encounter different issue(when I click on the green debug icon below).

请参见下图:

我发现这个解决办法(除正确答案的解决方案)

<一个href="http://$c$c.google.com/p/android/issues/detail?id=9932">http://$c$c.google.com/p/android/issues/detail?id=9932

和我下面的接受的答案。可能出现也是有用的:

And I've accepted answer below. Might come useful as well :

<一个href="https://groups.google.com/forum/?fromgroups#!topic/android-developers/DftP5gYcwYI">https://groups.google.com/forum/?fromgroups#!topic/android-developers/DftP5gYcwYI

推荐答案

我做的事情是这样的,

  1. 启用调试标志在AndroidManifest.xml文件。
  2. 在部署设备上的应用程序。您现在应该看到您在Eclipse上调试管理器应用程序的进程ID。
  3. 现在,配置在Eclipse中运行/配置菜单远程Java应用程序的运行/调试配置。
  4. 输入配置的所有细节。端口号将是你图片附件3列。
  5. 在启动设备上的应用程序之后运行远程​​Java应用程序配置在Eclipse。
  6. 您的应用程序现在应该打,如果任何断点。

这篇关于如何调试建成使用Maven Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆