6

My company does a lot of Android development and we're hampered by the long compile, dex, package, deploy cycles. Given the current state of the Dalvik VM and tools, is building something like JRebel for Android would be possible?

  • 1) Define long. 2) What are you doing now? (i.e. eclipse/maven/gradle what?) – Morrison Chang May 12 '13 at 19:41
  • I'm using Eclipse, but there is 15-30 second lag everytime you build the project to see changes that can be trivial (layout changes). Can dynamic classloading by used like in JRebel or [Play!](http://www.playframework.com/) to make changes visible immediately? – Ahmed Fathalla May 12 '13 at 19:50
  • I'm leaning toward no, but perhaps someone will correct me. If you are deploying to emulator/device then yes, you'll have some lag as it is going over adb. Your PC doesn't have direct access to the Dalvik VM. Remember your are cross-compiling & packaging, not deploying class files to a local webserver. If you are editing just the xml layout, you can try to use the layout preview tools to see how it will look. If I'm making code changes, I expect the delay mentioned. – Morrison Chang May 12 '13 at 20:01
  • What hardware device are you deploying to? How large is your apk? I assume you're using the usual Android Java and xml. I can't answer your question regarding Hot code swap, I don't know the answer to that one, but perhaps there are some other things you could do to minimize your build and deploy cycle. – Stephan Branczyk May 12 '13 at 20:02
  • I'm thinking the answer is yes, but super difficult. For instance, Google App Inventor has managed to implement amazing real-time hot code swapping functionality, but I believe their lower level is written in Scheme/LISP/C and they wrote their own VM. On a side-note, if your apk is too big, perhaps you could just rebuild the parts of the code that have changed on the device itself without having to transfer the entire apk again. https://code.google.com/p/terminal-ide/ This is just an idea, I haven't tested this idea myself. – Stephan Branczyk May 12 '13 at 20:28
  • I checked out the AppInventor documentation and see nothing related to HotSwap http://appinventor.mit.edu/explore/content/hellopurr.html, it just packages code as an APK. – Ahmed Fathalla May 13 '13 at 06:56
  • @MorrisonChang But can't we use some dynamic class loading techniques to change app behavior while it is running and avoid generating a new APK check out [this](http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html) and [this][2]. [1]: http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html [2]: https://code.google.com/p/dexmaker/ – Ahmed Fathalla May 13 '13 at 06:59
  • @Ahmed While you can dynamically class load, http://stackoverflow.com/questions/3022454/how-to-load-a-java-class-dynamically-on-android-dalvik, my impression is, its for loading custom components into an app. but not necessarily overwriting existing components to short circuit the install time which is what I think you are looking for. – Morrison Chang May 13 '13 at 07:08
  • That doesn't preclude someone from building a framework on top of dynamic class loading using some type of name mangling to achieve it, I'm just not sure how easy/performant it would be along with features like debugging. – Morrison Chang May 13 '13 at 07:15

2 Answers2

6

JRebel for Android is now in beta and you can now signup for an invite. Hopefully this will be what both of us want.

Matt Carron
  • 183
  • 3
  • 11
2

I've got the JRebel for Android beta access not long ago. And it's working already pretty fast: it tooks ~20sec to make-reload the project after changes. 20 sec is much faster than 2 min with Gradle.

It's still not live-coding for Android, but JRebel team works hard on optimizations. I bet that stable release of JRebel for Android will be close to live-coding.

Btw, there are alternatives for the JRebel for Android:

  1. Layout Cast - pretty unstable at the moment, and requires Android 5+
  2. Buck from Facebook. Haven't tried it by myself, but benchmarks say that it works faster than Gradle builds. Worth a try.
Veaceslav Gaidarji
  • 4,261
  • 3
  • 38
  • 61
  • protify is stable, and extremely fast, but needs a little bit of savvy to run (https://github.com/pfn/protify). – pfn Sep 30 '15 at 22:50
  • Could you please define in seconds "extremely fast"? I'm interested in "make-reload" time. – Veaceslav Gaidarji Oct 01 '15 at 07:36
  • 1
    Under 1 second for a trivial hello world. 10-20 seconds for a large app with 20mb resources, 100kloc and 60 libraries – pfn Oct 01 '15 at 14:47