我正在使用android-maven-plugin,当我尝试调试代码时,希望它在断点处停止,因此一直在等待调试器。
我曾经做过什么没事的工作。
我的POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.mycode.sgcv</groupId>
<artifactId>sgcv-android</artifactId>
<version>3.0.0</version>
<packaging>apk</packaging>
<name>sgcv-android</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version> 4.1.1.4</platform.version>
<android.plugin.version>4.0.0-rc.2</android.plugin.version>
<android.home>${env.ANDROID_HOME}</android.home>
<android.sdk.path>${env.ANDROID_HOME}</android.sdk.path>
<android.version>4.2.2_r3</android.version>
<android.platform>17</android.platform>
</properties>
<repositories>
<repository>
<id>android-support</id>
<url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.mindpipe.android</groupId>
<artifactId>android-logging-log4j</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Dependencias para trazas -->
<dependency>
<groupId>com.loopj.android</groupId>
<artifactId>android-async-http</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>4.46</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.osmdroid</groupId>
<artifactId>osmdroid-android</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.osmdroid.bonuspack</groupId>
<artifactId>osmbonuspack</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>de.grundid.opendatalab</groupId>
<artifactId>geojson-jackson</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-android</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>23.0.1</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>23.0.1</version>
<type>aar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>support-v4</artifactId>
<groupId>com.android.support</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.3.0</version> <!-- use latest release -->
<extensions>true</extensions>
<configuration>
<fork>false</fork>
<release>false</release>
<includeLibsJarsFromAar>true</includeLibsJarsFromAar>
<resourceDirectory>${basedir}/res</resourceDirectory>
<assetsDirectory>${basedir}/assets</assetsDirectory>
<androidManifestFile>${basedir}/AndroidManifest.xml</androidManifestFile>
<nativeLibrariesDirectory>${basedir}/libs</nativeLibrariesDirectory>
<run>
<debug>false</debug>
</run>
<sdk>
<platform>23</platform>
</sdk>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<versionRange>[4.3.0,)</versionRange>
<goals>
<goal>emma</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
我使用此目标运行应用程序:
-Dandroid.run.debug = true android:运行
有人有什么建议吗?
提前非常感谢你
最佳答案
我也没有弄清楚这应该如何与Android调试选项一起使用,但是我能够手动启动调试器(假设您的设备具有可用的调试选项):
与使用Maven一样,通常在没有调试选项的情况下将应用程序部署在设备上,然后启动它(clean install android:deploy android:run
)。
现在切换到DDMS视图(我仍在使用Eclipse,而不是Android Studio,因此在Android Studio中可能有所不同)
在DDMS视图中的设备标识符下,您会看到应用程序的软件包名称。旁边还有数字。第二个数字是您必须连接的端口。
创建调试配置Remote Java Application
。项目名称是根项目,主机是localhost
,端口是DDMS的给定端口,在我的情况下是8600
。连接类型为Socket Attach
。
现在,单击“调试”并在代码的任何位置设置断点。调试器将在那里停止。