2012-07-05 109 views
10

我目前正在尝试从eclipse调试我的设备上的android应用程序。如何调试使用maven构建的android应用程序

设备已添加我可以在控制台和eclipse中看到它。控制台(Windows)中:

adb devices 
List of devices attached 
0019cca27f2e6e device 

和Eclipse:

enter image description here

我可以毫不两个设备/模拟器任何问题,运行应用程序。我只是做clean installandroid:deploy其次android:run和作品像魅力。但我不知道如何调试它。

但是当我真的在设备上运行应用程序(三星Galaxy SII)时,我只能看到这两个进程执行com.viber.voipcom.viber.voip:keepAliveReceiver即使我运行它,我也没有看到我的应用程序。但是在模拟器/模拟器上,我可以看到我的应用程序正在运行。

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

debugging an app startup with android maven plugin

How to start application in command line with Maven

http://code.google.com/p/maven-android-plugin/wiki/Debug

不能坏了规矩。即使maven-exec-plugin试图通过下面调用脚本开始调试,这里是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 

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

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如果需要:

<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构建应用程序的设备?

问题更新:

加入android:debuggable="true"我的应用程序后出现的设备选项卡上,但我遇到不同的问题(当我点击绿色调试图标下方)。

请参阅以下内容:

enter image description here

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

http://code.google.com/p/android/issues/detail?id=9932

而且我接受的答案下面。可能出现有用的:

https://groups.google.com/forum/?fromgroups#!topic/android-developers/DftP5gYcwYI

回答

2

我做的事情是这样的,

  1. 启用AndroidManifest.xml文件调试标志。
  2. 在设备上部署应用程序。你现在应该在eclipse调试管理器上看到你的应用程序的进程ID。
  3. 现在,在eclipse run/config菜单中配置远程java应用程序的运行/调试配置。
  4. 输入配置的所有详细信息。端口号将是您图像附件的第3列。
  5. 在eclipse中启动设备上的应用程序“运行远程​​Java应用程序配置”。
  6. 您的应用程序现在应该打中断点(如果有的话)。
+0

有些事情发生了变化我更新了问题。谢谢 – ant 2012-07-05 14:32:11

+0

SDK工具修订版8提供了对调试的支持,开发人员不必在清单文件中包含android:debuggable属性(U可以深入了解http://stackoverflow.com/questions/23986724 /可-未设置可调试标志合androidmanifest-XML) – 2014-12-29 06:45:50

相关问题