Upgrade to Android 4.x jars?

220 views
Skip to first unread message

Michael Portuesi

unread,
Jun 6, 2012, 1:09:40 PM6/6/12
to robol...@googlegroups.com
Hi there,

I just returned from a break, and discovered that one of our team wrote a shadow for AsyncTask#executeOnExecutor.

It's an API level 11 call, and as such the current Robolectric, built against API 10 jars, fails the RobolectricWiringTest:

testAllImplementationMethodsHaveCorrectSignature(com.xtremelabs.robolectric.bytecode.RobolectricWiringTest)  Time elapsed: 0.416 sec  <<< FAILURE!
java.lang.AssertionError: @Implementation method mismatch: public final android.os.AsyncTask<Params, Progress, Result> com.xtremelabs.robolectric.shadows.ShadowAsyncTask.executeOnExecutor(java.util.concurrent.Executor,Params[]) doesn't match a real method expected:<0> but was:<1>

I've fixed the build in the main repo, but we're using this in our app, and so we want Robolectric to support it.

1) Is there any reason Robolectric is still using the API level 10 (Android 2.3.3) jars, other than a lack of necessity to upgrade before now?
2) Can we update to a newer set of jars?  Will there be anticipated problems, as with the Android support jar?

If no one has issues, I'd like to take a stab at the work.

Thanks,
Michael Portuesi

Tyler Schultz

unread,
Jun 6, 2012, 10:39:24 PM6/6/12
to robol...@googlegroups.com
Hi Michael,

I say go for it. I don't understand the issues that may be caused by the compatibility/support jars... It would be interesting to understand what the problems might be.


--Tyler

Christopher Perry

unread,
Jul 20, 2012, 1:53:33 PM7/20/12
to robol...@googlegroups.com
Hey Michael, I was about to use AsyncTask#executeOnExecutor and noticed that lack of support. How is your implementation coming along? I'd like to grab that code from you if you're done.

Michael Portuesi

unread,
Jul 20, 2012, 4:35:56 PM7/20/12
to robol...@googlegroups.com
Chris,

It turned out that whatever test we were writing didn't explicitly need an implmentation of AsyncTask#executeOnExecutor.  So, I haven't done any work on building Robolectric with Android 4.x jars.  I'm really sorry to disappoint.

Regards,
m

Michael Portuesi

unread,
Jul 25, 2012, 1:32:43 PM7/25/12
to robol...@googlegroups.com
Chris,

With the arrival of Jelly Bean, we've run into a situation where we need to get Robolectric running on 4.1.  In particular, Android's WebSettings has become an abstract class in Android 4.1, and tests which use WebView fail because Robolectric can no longer instantiate the abstract class via reflection.

So, I've done the work to get Robolectric building and passing tests against Android 4.0.1 in my local workarea (at least with the Maven build).  I'll likely be pushing those changes to master soon (including fixes for ant I hope), so I wanted to give a heads-up to those who might have been anticipating or fearing such a development.

4.0.1 still doesn't get me personally where I want to be - I need to build against 4.1 - but the maven repo at maven.org does not have Android 4.1 jars available.  Does anyone know anything about that process and how new jars get added over there?  I can do a local config and repository setup, but it's kind of a pain to do, especially for everyone across a development team.

Thanks,
Michael Portuesi

Michael Portuesi

unread,
Jul 30, 2012, 1:03:31 PM7/30/12
to robol...@googlegroups.com
Just a heads-up -

I've just pushed to pivotal-robolectric the changes to build Robolectric against the Android 4.0 jars.  Both the ant build.xml file and the maven POM are updated.

I would have targeted 4.1, but the public maven repositories don't yet have a 4.1 android.jar available, and I didn't want the build to get out of sync between the two build systems.  Once the maven-android maintainers burp out a 4.1 jar, I'll look into getting Robolectric building there.

I didn't update the Travis configuration in the build.xml, so the Travis CI build is currently busted (it was already failing prior to this change).  If there's anything I can do to help with that, please let me know.

Regards,
Michael Portuesi

Christopher Perry

unread,
Oct 1, 2012, 5:49:17 PM10/1/12
to robol...@googlegroups.com
I just now tried to build on 4.1 and noticed this issue with WebSettings. Arg! Thanks for the info.


On Wednesday, July 25, 2012 10:32:43 AM UTC-7, Michael Portuesi wrote:
Reply all
Reply to author
Forward
0 new messages