【问题标题】:Maven Android instrumentation test outputMaven Android 仪器测试输出
【发布时间】:2011-08-23 12:20:44
【问题描述】:

作为一个实验,我正在尝试使用 maven 来构建谷歌 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 结果,尤其是异常的堆栈跟踪?

【问题讨论】:

    标签: android maven junit


    【解决方案1】:

    当没有东西可以测试(你的主项目没有构建)时会出现这个错误。

    你的 maven 项目的结构必须是:

    your_project-parent

    |--your_project

    |--your_project-it

    your_project - 主项目

    your_project-parent - 父项目

    your_project-it - 仪器测试项目

    您必须在 your_project-perent 项目上运行 mvn install。

    然后首先构建主项目然后测试项目。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 1970-01-01
      相关资源
      最近更新 更多