@@ -19,7 +19,7 @@ Design Goals
1919
2020Version
2121-------
22- 2.0 (not yet released, but HEAD works)
22+ 2.0
2323
2424Working With AndroidJSCore
2525--------------------------
@@ -106,9 +106,40 @@ Objective-C.
106106The [ Javadocs] and included example app have detailed descriptions of how to do
107107just about everything.
108108
109+ Use AndroidJSCore in your project
110+ ---------------------------------
111+ The easy way is to simply download the file ` AndroidJSCore-2.0-release.aar ` from
112+ the [ latest release] and drop it somewhere in your project (` libs/ ` is meant just for this). Then
113+ add the following to your app-level ` build.gradle ` :
114+
115+ repositories {
116+ flatDir {
117+ dirs 'libs'
118+ }
119+ }
120+
121+ dependencies {
122+ compile(name:'AndroidJSCore-2.0-release', ext:'aar')
123+ }
124+
125+ Building the AndroidJSCoreExample app
126+ ---------------------------------
127+
128+ If you want to see AndroidJSCore in action, you can run the example app:
129+
130+ git clone https://github.com/ericwlange/AndroidJSCore.git ~/AndroidJSCore
131+ mkdir ~/AndroidJSCore/lib
132+
133+ Then download ` AndroidJSCore-2.0-release.aar ` from the [ latest release] and
134+ copy it into ` ~/AndroidJSCore/lib ` . Now you can open ` ~/AndroidJSCore/examples/AndroidJSCoreExample `
135+ in Android Studio and run it.
136+
109137Building AndroidJSCore-2.0 library
110138-------------------------------
111139
140+ If you are interested in building the library directly and possibly contributing, you must
141+ do the following:
142+
112143#### TL;DR - do this
113144
114145Set ` ANDROID_HOME ` and ` ANDROID_NDK_ROOT ` environment variables
@@ -118,6 +149,8 @@ Set `ANDROID_HOME` and `ANDROID_NDK_ROOT` environment variables
118149 % cd build
119150 % ../AndroidJSCore/scripts/build
120151
152+ Note the ` --recursive ` option in ` git clone ` . This is required for building the
153+ library, but not if you are just downloading the released library as with the example app above.
121154Your library now sits in ` lib/AndroidJSCore-2.0-release.aar ` . To use it, simply
122155add the following to your app's ` build.gradle ` :
123156
@@ -135,16 +168,18 @@ If something goes wrong or you want to understand what's going on, read on.
135168
136169#### Step 1 - Set up required tools
137170
138- At the moment, this has all been verified to work on Mac OSX. Once I can verify
139- that it builds on Linux, as well, I will tag and release 2.0. If anyone else is
140- married to that OS from Seattle, please feel free to get it working and contribute!
171+ This has all been verified to work on Mac OSX (specifically 10.11.2 El Capitan)
172+ and Linux (Ubuntu 14.04 LTS). If anyone else is married to that OS from Seattle,
173+ please feel free to get it working and contribute!
141174
1421751 . Download and install the latest version of [ Android Studio] , including the [ NDK]
1431762 . Set two environment variables: ` ANDROID_HOME ` and ` ANDROID_NDK_ROOT ` to point to the SDK and NDK directories, respectively
1441773 . Clone the repo: ` git clone --recursive https://github.com/ericwlange/AndroidJSCore.git `
145178
146179This last step will grab both the AndroidJSCore repo, as well as my fork of the
147- [ webkit] repo. The latter part is huge, like 6 GBs or something, so settle in.
180+ [ webkit] repo. The latter part is huge, like 6 GBs or something, so settle in. Not that
181+ the recursive clone is required for building the lib, but is not if you just want to
182+ build the example app.
148183
149184The build process requires a bunch of other standard UNIX tools, too. The below script will
150185complain if it can't find something, but you should expect to have the command-line
@@ -192,10 +227,16 @@ WebKit as a whole, but it doesn't seem to impact JavaScript to leave it out. If
192227reason your project isn't working because of this, you can link the lib back in with this
193228option.
194229
195- ` --enable-jit ` will allow architectures that build with just-in-time compilation to use
196- it. This should theoretically significantly improve the speed of JavaScript execution,
197- however as of the release of AndroidJSCore 2.0, enabling this flag on arm, at least,
198- causes the app to crash on load. In subsequent releases, I will try to get this to work.
230+ ` --disable-jit ` will disable just-in-time compilation for all architectures. Currently, it
231+ is disabled by default for ` armeabi ` and ` mips ` because they will not even compile, and it
232+ is turned off for ` armeabi-v7a ` because it causes the app to crash on load. In subsequent
233+ releases, I will try to get this to work. This should theoretically significantly improve
234+ the speed of JavaScript execution, and is currently enabled by default for ` x86 ` and the
235+ 64-bit arches.
236+
237+ ` --force-jit ` will force enable just-in-time compilation even for arches that don't work.
238+ Don't use this option unless you are trying to debug JIT. This option overrides ` --disable-jit `
239+ if used together.
199240
200241You may also specify target architectures explicitly. Currently, ` armeabi ` , ` armeabi-v7a ` ,
201242` x86 ` and ` mips ` build by default, but if you just want to build for a subset of these ABIs,
@@ -205,28 +246,6 @@ they crap out due to what appears to be a compiler bug in GCC 4.9. The `mips64`
205246won't even get off the ground. Future versions will include the 64-bit targets as the
206247tools mature.
207248
208- #### Step 4 - Use AndroidJSCore in your project
209-
210- You can now take ` AndroidJSCore-2.0-release.aar ` and drop it into your Android Studio
211- project. Just drop the file somewhere in your project (` libs/ ` is meant just for this) and
212- add the following to the app-level ` build.gradle ` :
213-
214- repositories {
215- flatDir {
216- dirs 'libs'
217- }
218- }
219-
220- dependencies {
221- compile(name:'AndroidJSCore-2.0-release', ext:'aar')
222- }
223-
224- Building the AndroidJSCoreExample app
225- ---------------------------------
226-
227- If you just want to see AndroidJSCore in action, once you've successfully built the library,
228- you can load the ` AndroidJSCoreExample ` project in ` examples/ ` and run it. That's it.
229-
230249Work in Progress
231250----------------
232251
@@ -260,7 +279,6 @@ I am just sticking with Webkit's license, since this thing depends on it.
260279 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261280 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262281
263- [ blog post ] :http://www.bignerdranch.com/blog/javascriptcore-and-ios-7/
264282[ NDK ] :http://developer.android.com/ndk/index.html
265283[ latest release ] :https://github.com/ericwlange/AndroidJSCore/releases
266284[ Android Studio ] :http://developer.android.com/sdk/index.html
0 commit comments