Android Integration Test Uses Old APK

I've created a beautiful Android project using Maven and the Android-Release Archetype. Now I have a simple problem: My integration tests don't use the newest version of my library under test.

When run Eclipse, Maven and M2E all seem to use an obsolete version (at least the app opened on my device for a split second looks that way). I first thought it might be Eclipse's stupid caching, but then Maven should be able to use the correct version. I deleted the bin and target folders and even the entries in the Maven repositories, but the build always pulls that old version out of thin air.

And just now I found that not only is the library under test obsolete, but there is a test executed via Maven and M2E that was deleted some time ago.

I know the question is pretty vague, but I'm not sure where to look for the source of the problem. Can anyone give me a pointer to what is happening?


Evidently these are at least two separate problems. I fixed the Eclipse portion by adding the library as dependency in the Android properties of the project. Since it's a problem with the android-maven-plugin now I'll post the relevant parts of the pom.xml of the integration test project in hopes that someone starting from the same archetype had the same problem and knows how to fix it:

<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>
<artifactId>org.acme.project.android.it</artifactId>
<packaging>apk</packaging>

<dependencies>
    <dependency>
        <groupId>org.acme.project</groupId>
        <artifactId>org.acme.project.android</artifactId>
        <version>${project.version}</version> 
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android-test</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <sdk>
                    <platform>16</platform>
                </sdk>
            </configuration>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>
</project>

Answers


You have to make sure the the version of the application you want to test is correct. In your case you are using version 1.0.0 ... while in reality the latest version under development is probably something like 1.1.0-SNAPSHOT.

Also you pom above is definitely invalid. Look at the samples project we provide as part of the Android Maven Plugin project.


The correct answer is: What I wanted to do (integration testing an Android library) is just not possible. I now test the app and it works.


Need Your Help

How do i detect if the user is “idle” with javascript?

javascript dom javascript-events mouse

I'm developing a "real-time" web application which sends AJAX requests to the server every 10 seconds. Obviously this is very bandwidth-intensive and I would like to know if there's any solution to...

Update same table after Insert trigger

oracle stored-procedures triggers oracle11g

I am working on a product in which I have to send SMS to concerned person when someone waits for more than 15 minutes for being served.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.