我目前正在尝试从eclipse调试我的设备上的android应用程序。如何调试使用maven构建的android应用程序
设备已添加我可以在控制台和eclipse中看到它。控制台(Windows)中:
adb devices
List of devices attached
0019cca27f2e6e device
和Eclipse:
我可以毫不两个设备/模拟器任何问题,运行应用程序。我只是做clean install
和android:deploy
其次android:run
和作品像魅力。但我不知道如何调试它。
但是当我真的在设备上运行应用程序(三星Galaxy SII)时,我只能看到这两个进程执行com.viber.voip
和com.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"
我的应用程序后出现的设备选项卡上,但我遇到不同的问题(当我点击绿色调试图标下方)。
请参阅以下内容:
我发现这个解决办法(除正确答案的解决方案):
http://code.google.com/p/android/issues/detail?id=9932
而且我接受的答案下面。可能出现有用的:
https://groups.google.com/forum/?fromgroups#!topic/android-developers/DftP5gYcwYI
有些事情发生了变化我更新了问题。谢谢 – ant 2012-07-05 14:32:11
SDK工具修订版8提供了对调试的支持,开发人员不必在清单文件中包含android:debuggable属性(U可以深入了解http://stackoverflow.com/questions/23986724 /可-未设置可调试标志合androidmanifest-XML) – 2014-12-29 06:45:50