As an experiment, I am trying to use maven to build the Google Android market licensing library, sample, and test projects. Here is the pom.xml for the test project:
<?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>
When I run mvn install in that project, I get the following error when the android instrumentation unit tests are run:
[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
What I really want to know is, where can I find the junit results, and especially the stack trace for the exception?
This error appears when nothing to test (your main project not build).
the structure of your maven project must be:
your_project-parent
|--your_project
|--your_project-it
When
your_project - main project
your_project-parent - parent project
your_project-it - instrumental testing project
You must run mvn install on your_project-perent project.
Then first builds main project then test project.
Related
I'm developing on android studio to do some stuff with geofire.
Apparently it can download the entire bundle and all, but it still gives me the message that it wouldn't. I really don't know what the error message means and how to solve the issue. I stepped into the repositories and saw all the files are there. And I do not have enough details on the process, so I could have a better understanding what could be the error.
Please help.
Here is my little experimental project to understand the error better.
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>org.example</groupId>
<artifactId>GreenMeadow</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.firebase</groupId>
<artifactId>geofire-android</artifactId>
<version>3.2.0</version>
<scope>pom</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Maven Central</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>firebase</id>
<url>https://dl.bintray.com/firebase/geofire/</url>
</repository>
<repository>
<id>google</id>
<url>https://maven.google.com/</url>
</repository>
</repositories>
As I said, it downloads the library but still comes up with the following error:
Failure to find com.firebase:geofire-android:jar:3.2.0 in https://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced . Try to run Maven import with -U flag (force update snapshots)
Then there is the original project with another POM and similar error of a dependent library that actually exists in the repository as well.
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>ai.spkf</groupId>
<artifactId>spkf-tools</artifactId>
<version>0.1.0</version>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<dependencies>
<dependency>
<groupId>ai.spkf</groupId>
<artifactId>spkf-sdk</artifactId>
<version>0.1.0-gson</version>
</dependency>
<dependency>
<groupId>ai.spkf</groupId>
<artifactId>spkf-lodar-services</artifactId>
<version>0.1.0</version>
</dependency>
<!-- Gson: Java to Json conversion -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.14.0</version>
</dependency>
<dependency>
<groupId>com.firebase</groupId>
<artifactId>geofire-java</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.13.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>google</id>
<url>https://maven.google.com/</url>
</repository>
<repository>
<id>firebase</id>
<url>https://dl.bintray.com/firebase/geofire/</url>
</repository>
</repositories>
Failure to find com.firebase:geofire-java:pom:3.0.0 in https://maven.google.com/ was cached in the local repository, resolution will not be reattempted until the update interval of google has elapsed or updates are forced
The library does not exist in the google repos but should be available in the other one.
Please advice, I'm losing it!
Thanks
Is there any command to execute or UI to see what is stored in my CrudRepository? I am creating a server using Spring which you can add pre-existing users or data into the database when running the server. Client (Android mobile) can also add or update the data of the repository.
Something similar to that of the client side like this:
http://www.coderzheaven.com/2012/01/23/working-with-sqlite-databases-through-command-line-in-android/
Here is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>spring-rest-service-oauth</artifactId>
<version>0.1.0</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<properties>
<spring-security-oauth2.version>2.0.7.RELEASE</spring-security-oauth2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring-security-oauth2.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-plugin-releases</id>
<url>https://repo.spring.io/plugins-release</url>
</pluginRepository>
</pluginRepositories>
As you can see in your pom.xml you are using HSQLDB which is an embedded database that is most likely running in-memory, started and managed automatically by your Spring Boot app.
You can visualize the content of the database using the HSQL Database Manager GUI.
See here for a HOW-TO guide: View content of HSQLDB embedded database
I am trying to add google play services to existing android maven project using jar and apklib. The project does compile using mvn clean install, but in Eclipse i am getting this error:
Error: No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version'). AndroidManifest.xml /pruebas-bundle-android line 51 Android AAPT Problem
I am new with maven, so i don´t know what could cause this. I have searched for information on the error but have not found anything that could let me solve it. I am using maven 3.2.2 and m2e 1.4. This is my pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pruebas.pruebas</groupId>
<artifactId>pruebas-bundle-android</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apk</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.4.2_r3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>20.0.0</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>19.0.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>19.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>urbanairship</groupId>
<artifactId>urbanairship-lib</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>com.crittercism</groupId>
<artifactId>crittercism-android-agent</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>local-repository</id>
<url>file:${basedir}/local-repository</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.9.0-rc.3</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>19</platform>
</sdk>
<manifest>
<debuggable>false</debuggable>
</manifest>
</configuration>
</plugin>
</plugins>
</build>
</project>
The problem seems to be due to the apklib. In Eclipse, i can see all my dependencies jar in Maven dependencies, but i don´t know how to make available the google play services apklib in Eclipse. I would appreciate any help with this.
In order to compile a project with an Android Library (APKLIB) dependency in Eclipse you need to have m2e-android installed and a "Mavenised" copy of the Android Library source code checked-out into your local Eclipse workspace.
When I say "Mavenised" I mean that the Android Library project should have a POM with coordinates (group ID, version, etc.) that match the apklib dependency in you application POM.
I converted my Android project into Maven project. I have support library called appcompat_v7, which I would like to add into my Maven dependencies.
I read that I should add dependencies to pom.xml
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>19.1.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>19.1.0</version>
<type>jar</type>
</dependency>
Also built jar and apklib by running:
mvn install:install-file -Dfile="./com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.aar"/ -DpomFile="./com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.pom"/ -Dpackaging="apklib"
mvn install:install-file -Dfile="./com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.jar"/ -DpomFile="./com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.pom"/ -Dpackaging="jar"
My pom.xml is now following:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ProjectTest</groupId>
<artifactId>ProjectTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>19.1.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>19.1.0</version>
<type>jar</type>
</dependency>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source/>
<target/>
</configuration>
</plugin>
</plugins>
</build>
</project>
I am still having error ''R cannot be resolved to a variable'' after I deleted support libraby appcompat_v7
I have this Android project and some difficulty configuring the build with Maven & Robolectric. If I set the scope of the robolectric dependency to 'test', then the project builds fine, but the tests fail to run [wrong version of junit or java.lang.NoClassDefFoundError]. If I don't set the scope of the robolectric dependency, the tests run fine (and pass) but the build runs out of heap space.
I'm new to Maven and am probably doing something wrong.
My dependencies look this ::
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.0-alpha-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-core</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.0-rc2</version>
<scope>test</scope>
</dependency>
</dependencies>
Any wisdom on what's going on here will be gratefully received and put to immediate good use :)
Here's the complete pom.xml after updating with Matt's advice. (below) Unfortunately the issue persists.
<?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>com.odl</groupId>
<artifactId>GhostRunner</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>GhostRunner</name>
<properties>
<platform.version> 2.3.3 </platform.version>
<android.sdk.path>/Users/chrisdanson/Development/android-sdk-macosx</android.sdk.path>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.1</version>
<!--<scope>test</scope>-->
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-core</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>4.45</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>10</platform>
</sdk>
<undeployBeforeDeploy>true</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>
</plugins>
</build>
</project>
So .. having updated the plugin dependency versions and run a mvn 'clean' & 'install' as well the problem is still present. Running a robolectric test gives the following output >>
java.lang.NoClassDefFoundError: org/objectweb/asm/Opcodes
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getConstructor(Class.java:1657)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:43)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Opcodes
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 30 more
Further investigation >
This link shows jars that contain Opcodes and I've added this dependency I found here
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>2.2</version>
</dependency>
I've added this as the first dependency in the pom and I still get NoClassDefFound for OpCodes.
Finally found something that seems to work :: have added <classifier>jar-with-dependencies</classifier> to the robolectric dependency and the tests finally run.
I see you have
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.0-alpha-1</version>
<scope>test</scope>
</dependency>
and then
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.0-rc2</version>
<scope>test</scope>
</dependency>
I don't believe you can have the same dependency listed twice like that and have the app compile but I may be wrong.
None the less, try updating some of your dependency versions. I'm using junit 4.10 with success, along with robolectric 2.1 (2.0 worked as well when I was using that), then mockito is at 1.9.5 as well.
I recommend checking maven central for latest dependencies. I believe there were issues with jUnit 4.11 and robolectric previously though so I haven't tried to upgrade that to 4.11 yet.