Getting started with Android

JIPR is an alpha product, which means you're likely to hit bugs. This guide is intended to be a streamlined tutorial to help you get started with JIPR. It's designed to be simple, expository, and most importantly should not randomly fail on you! As you progress from this tutorial, and use JIPR with real code, we welcome you to report bugs and feature requests to us.


First, install JIPR.

This guide assumes knowledge of Android development. It assumes you have Android Studio installed. We'll work with a gradle project, but keep in mind that JIPR is independent of IDE or build system.

This sample also assumes either Mac OS or Linux. There's nothing in JIPR that prevents it from running on Windows, we just haven't gotten to verifying that it works.

Sample project

Download the sample Android Studio project. We'll work with this simple project for the rest of this guide.

Once you download the project you can run the application in an emulator. It's a very simple application with a button and a counter.

Launch the app with JIPR

In the previous step you launched the app with IntelliJ. However, in order to use JIPR you must launch the app with the jipr command line tool.

$ export PATH=~/jipr/bin:$PATH
$ ./gradlew installDebug
$ jipr android-launch -p com.example com.example.jipr

In the above command, we're telling jipr to launch the app `com.example.jipr`, and we'll telling it to instrument `com.example`, which allows us to override classes below that package. At this point click the the Increment button a few times, say five times, so that the message now reads "The counter is 5"


Making changes

Load up app/src/main/com/example/jipr/ in your editor of choice. Let's update onIncrClick to read as follows:

  private void onIncrClick () {
    tv.setText("You've clicked " + counter + " times");

Now, let's update the running app with the new changes:

$ jipr reload app/src/main/com/example/jipr/

Go back to your emulator, and click the Increment button, you'll see the text "You've clicked 6 times"

Where do we go from here?

Feel free to play with this sample app with other changes. You'll eventually hit cases that JIPR hasn't implemented very well for now.

All of this was a demo. If you're working with changes inside of a single method, JIPR can work pretty reliably. We're of couse making JIPR work in all sorts of circumstances adding/removing methods and fields, introducing new classes, etc. We believe we can make each of these situations work seamlessly, but we do need your support along the way.

< Home