REST-Assured and Android

231 views
Skip to first unread message

Tiago Veloso

unread,
Mar 9, 2015, 1:50:22 PM3/9/15
to rest-a...@googlegroups.com
I am trying to use REST-Assuered in an android project.

However, when using the jsonPath I get a NoClassDefFound exception:

java.lang.NoClassDefFoundError: java.beans.PropertyDescriptor
            at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
            at libcore.reflect.InternalNames.getClass(InternalNames.java:30)
            at java.lang.Class.getDexCacheType(Class.java:479)
            at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:229)
            at java.lang.reflect.ArtMethod.getParameterTypes(ArtMethod.java:169)
            at java.lang.reflect.Method.getParameterTypes(Method.java:174)
            at java.lang.Class.getDeclaredMethods(Class.java:772)
            at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
            at java.security.AccessController.doPrivileged(AccessController.java:45)
            at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
            at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)
            at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
            at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
            at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250)
            at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:313)
            at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:292)
            at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3045)
            at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:119)
            at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71)
            at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
            at org.codehaus.groovy.reflection.ClassInfo.isValidWeakMetaClass(ClassInfo.java:221)
            at org.codehaus.groovy.reflection.ClassInfo.getMetaClassForClass(ClassInfo.java:191)
            at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:236)
            at com.jayway.restassured.internal.path.json.JSONAssertion.$getStaticMetaClass(JSONAssertion.groovy)
            at com.jayway.restassured.internal.path.json.JSONAssertion.<init>(JSONAssertion.groovy)
            at com.jayway.restassured.path.json.JsonPath.createJsonAssertion(JsonPath.java:928)
            at com.jayway.restassured.path.json.JsonPath.get(JsonPath.java:200)


I am aware that the java.beans package is not supported in android. But there is an alternative, the openbeans project.

I am trying to figure out a way of integrating both, but can't find how. I made a suggestion to use the openbeans project in the issue tracker.

Johan Haleby

unread,
Mar 9, 2015, 1:51:48 PM3/9/15
to rest-a...@googlegroups.com
Hmm looks to me that Groovy fails. I'm not sure Groovy is supported on Android, I think Groovy needs to do several byte-code tricks.

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tiago Veloso

unread,
Mar 10, 2015, 6:28:00 AM3/10/15
to rest-a...@googlegroups.com
That's probably it.

Groovy is only supported for android from version 2.4 and onward. And it requires an additional plugin. Maybe it's not just a java.beans problem.

Johan Haleby

unread,
Mar 10, 2015, 6:43:57 AM3/10/15
to rest-a...@googlegroups.com
You can try depending on Groovy 2.4 instead, follow the instructions on the FAQ but change Groovy version to 2.4.1 or something similar.

Tiago Veloso

unread,
Mar 10, 2015, 7:34:21 AM3/10/15
to rest-a...@googlegroups.com
I will be sure to have a look at that, when I find some time.

I am trying to use a library that depends on REST-Assured, (retromock: https://github.com/groupon/retromock) wich works fine under JDK 7 & 8.
I have modified it to build with the android SDK, and it works. I just can't seem to get the REST-Assured bit working though. It comes in handy to check the body of the requests I send.


You received this message because you are subscribed to a topic in the Google Groups "REST assured" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rest-assured/I9bE6ctyuI0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rest-assured...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages