【发布时间】:2012-07-05 22:34:42
【问题描述】:
我目前正在尝试从 Eclipse 调试我的设备上的 android 应用程序。
设备已添加,我可以在控制台和 Eclipse 中看到它。控制台(Windows):
adb devices
List of devices attached
0019cca27f2e6e device
还有日食:
我可以在两个设备/模拟器上运行该应用程序而不会出现任何问题。我只是做clean install 和android:deploy,然后是android:run,就像一个魅力。但我还不知道如何调试它。
但是当我实际在设备上运行应用程序(Samsung 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
【问题讨论】:
标签: java android maven android-intent maven-2