I finished building RStudio on my Nexus 5. I'm making these notes for anyone who might find them helpful, including my future self if I need to do it again for any reason. I assume you've already installed R with
sudo apt-get install r-base
First of all, you need to download the source for RStudio to your device. Just go to the github page and download the zip
https://github.com/rstudio/rstudio
Once you do that, you basically just need to follow the instructions in the INSTALL document
https://github.com/rstudio/rstudio/blob/master/INSTALL
There are some gotchas though. For starters, it says you need to install the dependencies, but it doesn't spell it out. I overlooked that section and started installing dependencies as I ran into the need for them one at a time with apt-get. So to spare yourself the trouble, cd into the dependencies/linux directory and
./install-dependencies-debian
(I assume you're running ubuntu on your phone. You may need one of the other scripts if not)
That took quite a while. Like hours it seemed. But it will finally finish building as long as you don't let you phone screen sleep.
That's another gotcha. I didn't have the problem installing dependencies by dumb luck. I decided to read some news on the web while it installed dependencies. That kept the phone awake and building. Later, when I built RStudio, I let it sleep and went to bed, only to wake to no progress in the build. I only figured it out because I forgot it was building, and left with the phone in my pocket.
I remembered a few hours later, but noticed the battery had not drained significantly. That told me the phone was idle and explained why there was no progress in the build. So I set screen sleep to 30 minutes and kept it awake and build progress began. It finished the build after 13 hours. It will probably only take a couple of hours if you keep the screen awake the whole time.
Finally, there's one last problem I encountered. I had to replace the compiler.jar in the source with a newer version. Specifically, this version
https://code.google.com/p/closure-compiler/downloads/detail?name=compiler-20130823.zip&can=2&q=
The version located in
src/gwt/tools/compiler
appears to hang forever when compiling gwt. I tried the latest version of the jar with no luck too. It required that specific version of compiler.jar to work, for whatever reason.
Also, there's a bonus possible gotcha. It's that you may need to build with the older JDK6 downloaded by the dependencies script. I read somewhere that it would not compile with the openjdk 7 which I had installed before installing RStudio. I didn't try building with JDK 7 because I just wanted it working at that point. If you have both installed, you can switch between them with
sudo update-alternatives --config java
Hopefully that helps save someone a lot of time. It ended up taking me more than a week to find all this.