How to build android.jar without throw new RuntimeException(“Stub!”);

461 views
Skip to first unread message

Hao Yang

unread,
Feb 9, 2017, 4:45:54 AM2/9/17
to Robolectric
Dear all, I want build a binary android.jar containing the the real implementations of each method, but i don't know how to do it. I download the android open source code, and build the source code according to https://source.android.com/source/building.html. However, the generated android.jar only contains stub implementations of the SDK classes. Could you tell me how to modify the configurations to generate android.jar containing the real implementations, just as the binary jar on http://grepcode.com/snapshot/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1. Thanks very much.

Christian Williams

unread,
Feb 9, 2017, 7:01:40 PM2/9/17
to Robolectric
Hi Hao! Robolectric has pre-built Android binaries for serveral versions here: http://central.maven.org/maven2/org/robolectric/android-all/ -- if you use Robolectric 2 or higher, it automatically uses them.

If those don't serve your purposes, you can find the a script here which helps with building from Android source: https://github.com/robolectric/robolectric/blob/master/scripts/build-android.sh

Hope that helps!

--X

Hao Yang

unread,
Feb 12, 2017, 10:40:35 PM2/12/17
to Robolectric
Thank you very much for your help! It solves my problem. Very Good!

在 2017年2月10日星期五 UTC+8上午8:01:40,Christian Williams写道:
Reply all
Reply to author
Forward
0 new messages