I'm looking for an open-source remote REPL for Android's Java API that runs on Linux. That is, the commands will be typed into my Linux desktop, but they will be executed using the Java API on an Android device of my choosing. I'm looking for an alternative to creating and running an .apk each time I want to play with API methods and objects.
Java on the desktop has a number of REPLs, such as those for Jython, BeanShell, and Groovy. A motivating example from Jython:
$ jython Jython 2.5.3 (, Oct 8 2014, 03:39:09) [OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.8.0_102 Type "help", "copyright", "credits" or "license" for more information. >>> from java.lang import String >>> String('one two three').substring(4, 8) u'two '
I would like to be able to test things like this on a real Android device, without having to type them on my phone's keyboard.
It looks to me like Clojure might have this feature, but I'm not yet comfortable at all with Lisp-like languages, so that won't work for me. Anything with a syntax similar to C, shell scripting, BASIC, or even non-Lisp-like functional programming, should be fine.
It's fine for me if not everything in the API works, as long as most things do. I'm looking to experiment, not embed this into a final product. I'd really prefer this to be able to be run on non-rooted devices.
Features that I don't require, but would make this even more useful for me:
- easy introspection of objects in the REPL (finding the names, and possibly signatures, of their methods and fields, without having to go look them up myself)
- some way to add third-party Android libraries and then test them. Even if this requires creating and uploading an .apk to the device, so long as afterwards they can be tested in the same remote REPL.
- anything that makes it easier to write and test multi-line code in the REPL
- an easy way to save my REPL's history