First off THANKS! My head was about to explode everytime the painful native Android "unittest" started

91 views
Skip to first unread message

Kennedyshead

unread,
Sep 14, 2012, 3:13:22 AM9/14/12
to robol...@googlegroups.com
I really just wanted to drop in and say thanks!

We at Thefarm Interactive now uses roboelectric on all our Android projects, we will try to help out with the development of roboelectric in anyway we can!

Our current setup is Eclipse, Maven, roboelectric, undercover, Jenkins all is working like a charm and the code just got 1000-times more stable :)

I would really like to start a little "debate" forum on what tools to use and why. 

Kennedyshead

unread,
Oct 31, 2012, 3:24:26 PM10/31/12
to robol...@googlegroups.com
Hi!

Well to start with set up a new pom in your android project, mine looks something like this:

<?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>se.thefarm</groupId>

<artifactId></artifactId>

<version>0.0.0</version>

<packaging>apk</packaging>

<name></name>

<pluginRepositories>

<pluginRepository>

<id>zact-snaphost</id>

<url>http://zact.googlecode.com/svn/maven/snapshot-repository</url>

<snapshots>

<enabled>true</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

<repositories>

<repository>

<id>zact-snaphost</id>

<url>http://zact.googlecode.com/svn/maven/snapshot-repository</url>

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

<repository>

<id>acra-repository</id>

<name>acra Maven2 repository</name>

<url>http://acra.googlecode.com/svn/repository/releases</url>

</repository>

</repositories>

<properties>

<platform.version> 4.1.1.4</platform.version>

</properties>

<dependencies>

<dependency>

<groupId>com.google.android</groupId>

<artifactId>android</artifactId>

<version>${platform.version}</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.actionbarsherlock</groupId>

<artifactId>library</artifactId>

<version>4.1.0</version>

<type>apklib</type>

</dependency>

<dependency>

<groupId>org.acra</groupId>

<artifactId>acra</artifactId>

<version>4.3.0b2</version>

</dependency>

<dependency>

<groupId>android.support</groupId>

<artifactId>compatibility-v4</artifactId>

<version>r10</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.google.android.gcm</groupId>

<artifactId>gcm-client</artifactId>

<version>r3</version>

</dependency>

<dependency>

<groupId>org.codehaus.jackson</groupId>

<artifactId>jackson-jaxrs</artifactId>

<version>1.9.9</version>

</dependency>

<dependency>

<groupId>com.j256.ormlite</groupId>

<artifactId>ormlite-android</artifactId>

<version>4.41</version>

</dependency>

<!-- Make sure this is below the android dependencies -->

<dependency>

<groupId>com.pivotallabs</groupId>

<artifactId>robolectric</artifactId>

<version>1.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.8.2</version>

<scope>test</scope>

</dependency>

</dependencies>

<build>

<finalName>${project.name}</finalName>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-jarsigner-plugin</artifactId>

<version>1.2</version>

<executions>

<execution>

<id>signing</id>

<goals>

<goal>sign</goal>

</goals>

<phase>package</phase>

<inherited>true</inherited>

<configuration>

<archiveDirectory></archiveDirectory>

<includes>

<include>target/${project.build.finalName}.apk</include>

</includes>

<keystore>./inner.keystore</keystore>

<storepass>inner2012</storepass>

<alias>inner</alias>

<arguments>

<argument>-sigalg</argument>

<argument>MD5withRSA</argument>

<argument>-digestalg</argument>

<argument>SHA1</argument>

</arguments>

</configuration>

</execution>

</executions>

</plugin>

<plugin>

<groupId>com.jayway.maven.plugins.android.generation2</groupId>

<artifactId>android-maven-plugin</artifactId>

<version>3.3.2</version>

<configuration>

<sign>

<debug>false</debug>

</sign>

<lifecycleMappingMetadata>

<pluginExecutions>

<pluginExecution>

<pluginExecutionFilter>

<groupId>some-group-id</groupId>

<artifactId>some-artifact-id</artifactId>

<versionRange>[1.0.0,)</versionRange>

<goals>

<goal>install</goal>

</goals>

</pluginExecutionFilter>

<action>

<ignore />

</action>

</pluginExecution>

</pluginExecutions>

</lifecycleMappingMetadata>

<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>

<assetsDirectory>${project.basedir}/assets</assetsDirectory>

<resourceDirectory>${project.basedir}/res</resourceDirectory>

<nativeLibrariesDirectory>${project.basedir}/src/java/main/</nativeLibrariesDirectory>

<sdk>

<platform>15</platform>

</sdk>

<undeployBeforeDeploy>false</undeployBeforeDeploy>

</configuration>

<extensions>true</extensions>

</plugin>

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.6</source>

<target>1.6</target>

</configuration>

</plugin>

<plugin>

<groupId>undercover</groupId>

<artifactId>undercover-maven-plugin</artifactId>

<version>0.8.5-SNAPSHOT</version>

<configuration>

<sourceEncoding>UTF-8</sourceEncoding>

<exclude>gen/</exclude>

<formats>

<format>html</format>

</formats>

</configuration>

</plugin>

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>sonar-maven-plugin</artifactId>

<version>1.0</version>

</plugin>

</plugins>

</build>

</project>

That did the trick (and does locally) but I got a NullPointer on the CI now, submittet a bugreport here: http://code.google.com/p/undercover/issues/detail?id=10

Basically that was all there was to it, the repository stuff was a headache though... So im setting upp my own maven repo now :)

Hope this helps

Den tisdagen den 30:e oktober 2012 kl. 06:38:05 UTC+1 skrev Neal:
I've been trying to get undercover working with Robolectric built with Maven, can you share your knowledge on how this is accomplished?

Thanks in advance.

-Neal
Reply all
Reply to author
Forward
0 new messages