作为一项实验,我正在尝试使用maven来构建Google Android市场许可库,示例和测试项目。这是测试项目的pom.xml:
<?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>etherwalker.example</groupId>
<artifactId>license_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>License - Instrumentation Tests</name>
<parent>
<groupId>etherwalker.example</groupId>
<artifactId>license_parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>etherwalker.example</groupId>
<artifactId>license_sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>apk</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>etherwalker.example</groupId>
<artifactId>license_sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
当我在该项目中运行mvn install
时,运行android检测单元测试时出现以下错误:
[INFO] C:\usr\android-sdk-windows/platform-tools/adb.exe [shell, am, instrument, -w, com.example.android.market.licensing.test/android.test.InstrumentationTestRunner]
com.android.vending.licensing.AESObfuscatorTest:.......
com.android.vending.licensing.ObfuscatedPreferencesTest:INSTRUMENTATION_RESULT: shortMsg=java.security.spec.InvalidKeySpecException
INSTRUMENTATION_RESULT: longMsg=java.security.spec.InvalidKeySpecException: java.io.EOFException: EOF encountered in middle of object
INSTRUMENTATION_CODE: 0
我真正想知道的是,我在哪里可以找到junit结果,特别是异常的堆栈跟踪?
答案 0 :(得分:0)
如果没有要测试的任何内容(您的主项目未构建),则会出现此错误。
你的maven项目的结构必须是:
<强> your_project-父强>
<强> | --your_project 强>
| --your_project-it
何时
your_project - 主要项目
your_project-parent - 父项目
your_project-it - 工具测试项目
您必须在 your_project-perent 项目上运行mvn install。
然后首先构建主项目然后测试项目。