Run Android test with Robolectric - dependency error -
i using android studio 1.2 , windows 7
when running robolectric test following example:
@runwith(customrobolectricrunner.class) @config(emulatesdk = 21, reportsdk = 21, constants = buildconfig.class) public class passwordprovidertest{ @test public void testgetpassword() throws exception { activity activity = robolectric.setupactivity(loginactivity.class); } @test public void testsetpassword() throws exception { } }
test result or more error stacktrace:
unable resolve artifact: unable dependency information: unable read metadata file artifact 'org.robolectric:android-all:jar': cannot find parent: org.sonatype.oss:oss-parent project: org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 project org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 specified remote repositories: sonatype (https://oss.sonatype.org/content/groups/public/), central (http://repo1.maven.org/maven2) path dependency: 1) org.apache.maven:super-pom:pom:2.0 @ org.apache.maven.artifact.ant.dependenciestask.doexecuteresolution(dependenciestask.java:268) @ org.apache.maven.artifact.ant.dependenciestask.doexecute(dependenciestask.java:168) @ org.apache.maven.artifact.ant.abstractartifacttask.execute(abstractartifacttask.java:751) @ org.robolectric.internal.dependency.mavendependencyresolver.getlocalartifacturls(mavendependencyresolver.java:40) @ org.robolectric.internal.dependency.cacheddependencyresolver.getlocalartifacturls(cacheddependencyresolver.java:42) @ org.robolectric.robolectrictestrunner.createrobolectricclassloader(robolectrictestrunner.java:151) @ org.robolectric.robolectrictestrunner.createsdkenvironment(robolectrictestrunner.java:122) @ org.robolectric.robolectrictestrunner$3.create(robolectrictestrunner.java:285) @ org.robolectric.internal.envholder.getsdkenvironment(envholder.java:18) @ org.robolectric.robolectrictestrunner.getenvironment(robolectrictestrunner.java:283) @ org.robolectric.robolectrictestrunner.access$300(robolectrictestrunner.java:50) @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:193) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:78) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:57) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.robolectric.robolectrictestrunner$1.evaluate(robolectrictestrunner.java:168) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.runtestclass(junittestclassexecuter.java:86) @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.execute(junittestclassexecuter.java:49) @ org.gradle.api.internal.tasks.testing.junit.junittestclassprocessor.processtestclass(junittestclassprocessor.java:69) @ org.gradle.api.internal.tasks.testing.suitetestclassprocessor.processtestclass(suitetestclassprocessor.java:48) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:35) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:24) @ org.gradle.messaging.dispatch.contextclassloaderdispatch.dispatch(contextclassloaderdispatch.java:32) @ org.gradle.messaging.dispatch.proxydispatchadapter$dispatchinginvocationhandler.invoke(proxydispatchadapter.java:93) @ com.sun.proxy.$proxy2.processtestclass(unknown source) @ org.gradle.api.internal.tasks.testing.worker.testworker.processtestclass(testworker.java:105) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:35) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:24) @ org.gradle.messaging.remote.internal.hub.messagehub$handler.run(messagehub.java:360) @ org.gradle.internal.concurrent.defaultexecutorfactory$stoppableexecutorimpl$1.run(defaultexecutorfactory.java:64) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) caused by: org.apache.maven.artifact.resolver.artifactresolutionexception: unable dependency information: unable read metadata file artifact 'org.robolectric:android-all:jar': cannot find parent: org.sonatype.oss:oss-parent project: org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 project org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 specified remote repositories: sonatype (https://oss.sonatype.org/content/groups/public/), central (http://repo1.maven.org/maven2) path dependency: 1) org.apache.maven:super-pom:pom:2.0 @ org.apache.maven.artifact.resolver.defaultartifactcollector.recurse(defaultartifactcollector.java:430) @ org.apache.maven.artifact.resolver.defaultartifactcollector.collect(defaultartifactcollector.java:74) @ org.apache.maven.artifact.resolver.defaultartifactresolver.resolvetransitively(defaultartifactresolver.java:316) @ org.apache.maven.artifact.ant.dependenciestask.doexecuteresolution(dependenciestask.java:263) ... 46 more caused by: org.apache.maven.artifact.metadata.artifactmetadataretrievalexception: unable read metadata file artifact 'org.robolectric:android-all:jar': cannot find parent: org.sonatype.oss:oss-parent project: org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 project org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 @ org.apache.maven.project.artifact.mavenmetadatasource.retrieverelocatedproject(mavenmetadatasource.java:200) @ org.apache.maven.project.artifact.mavenmetadatasource.retrieverelocatedartifact(mavenmetadatasource.java:94) @ org.apache.maven.artifact.resolver.defaultartifactcollector.recurse(defaultartifactcollector.java:387) ... 49 more caused by: org.apache.maven.project.projectbuildingexception: cannot find parent: org.sonatype.oss:oss-parent project: org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 project org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 @ org.apache.maven.project.defaultmavenprojectbuilder.assemblelineage(defaultmavenprojectbuilder.java:1396) @ org.apache.maven.project.defaultmavenprojectbuilder.buildinternal(defaultmavenprojectbuilder.java:823) @ org.apache.maven.project.defaultmavenprojectbuilder.buildfromrepository(defaultmavenprojectbuilder.java:255) @ org.apache.maven.project.artifact.mavenmetadatasource.retrieverelocatedproject(mavenmetadatasource.java:163) ... 51 more caused by: org.apache.maven.project.projectbuildingexception: pom 'org.sonatype.oss:oss-parent' not found in repository: unable download artifact repository org.sonatype.oss:oss-parent:pom:7 specified remote repositories: sonatype (https://oss.sonatype.org/content/groups/public/), central (http://repo1.maven.org/maven2) project org.sonatype.oss:oss-parent @ org.apache.maven.project.defaultmavenprojectbuilder.findmodelfromrepository(defaultmavenprojectbuilder.java:605) @ org.apache.maven.project.defaultmavenprojectbuilder.assemblelineage(defaultmavenprojectbuilder.java:1392) ... 54 more caused by: org.apache.maven.artifact.resolver.artifactnotfoundexception: unable download artifact repository org.sonatype.oss:oss-parent:pom:7 specified remote repositories: sonatype (https://oss.sonatype.org/content/groups/public/), central (http://repo1.maven.org/maven2) @ org.apache.maven.artifact.resolver.defaultartifactresolver.resolve(defaultartifactresolver.java:228) @ org.apache.maven.artifact.resolver.defaultartifactresolver.resolve(defaultartifactresolver.java:90) @ org.apache.maven.pr oject.defaultmavenprojectbuilder.findmodelfromrepository(defaultmavenprojectbuilder.java:558) ... 55 more caused by: org.apache.maven.wagon.resourcedoesnotexistexception: unable download artifact repository @ org.apache.maven.artifact.manager.defaultwagonmanager.getartifact(defaultwagonmanager.java:404) @ org.apache.maven.artifact.resolver.defaultartifactresolver.resolve(defaultartifactresolver.java:216) ... 57 more
gradle build dependencies:
testcompile 'junit:junit:4.12' testcompile "org.mockito:mockito-core:1.9.5" testcompile 'org.apache.maven:maven-ant-tasks:2.1.3' testcompile "org.robolectric:robolectric:3.0-rc2"
i find out resource, robolectric try ,is not avaible. when following url trys it: https://oss.sonatype.org/content/groups/public/org/sonatype/oss/oss-parent/
there no oss 7. why robolectrics try resource not there? , how work?
this seems proxy problem. when behind proxy have specify proxy settings maven @ {userhome}/.m2/settings.xml
my settings.xml looks like:
<settings> <proxies> <proxy> <active>true</active> <host>proxy.host</host> <port>3128</port> </proxy> </proxies> </settings>
below not working !!
<settings> <proxies> <proxy> <id>proxy-https</id> <active>true</active> <protocol>https</protocol> <host>proxy.host</host> <port>3128</port> </proxy> <proxy> <id>proxy-http</id> <active>true</active> <protocol>http</protocol> <host>proxy.host</host> <port>3128</port> </proxy> </proxies> </settings>
Comments
Post a Comment