I am trying to switch my android development environment to a scala-based one, but the turn-around times (caused by stripping down the scala libraries to the used parts only using ProGuard) are killing me.
There are some tutorials available regarding a process of pre-installing the scala libraries in the emulator by creating a new ramdisk image and adding the libraries to the so called BOOTCLASSPATH. The result should be, that I do not need to integrate the scala libs into my debug build anymore and thus can dramatically decrease the turn around times (one such tutorial is available here).
I’ve followed these tutorials and it is working fine for android 2.3.x (API level 10) but when applying it to an ICS emulator (API level 14/15) or the Jelly Bean emulator (API level 16) they get stuck in a boot loop after the modification. The ICS emulator is especially important to me as I am using the x86 image with hardware accelerated emulation as it is so much faster than the ARM images.
Any ideas on how to pre-install the scala libraries on an ICS emulator or above?
After searching around a little bit longer I stumbled across the Android-Scala-Installer which allows to pre-install the scala libraries on a rooted android device. It uses another mechanism: Instead of adjusting the
BOOTCLASSPATHit defines additional permissions which can then be referenced in yourAndroidManifest.xmlusing a<uses-library />statement.Unfortunately the installer isn’t working on an emulator, but I’ve applied the general mechanism and created a scala script which completely automates the whole installation process for the emulator of your choice and works fine for x86 and ARM images — simply call the script and it will start the emulator and do all the installation stuff and you are done. Currently the script only runs on Windows.
The script currently brings the scala 2.9.2 and 2.10.0-M7 libs bundled and can be found at github.
Tip: To save myself from adjusting the
AndroidManifest.xmlwhen switching between debug and release builds I’ve split my app up into an android library project which contains all code of the app and two application projects — both referencing the library project. One of the app projects is for the debug builds and contains the relevant<uses-library />statements and the other project is for release builds and includes the scala libraries into the build process, so that they are part of the delivered APK.Hope this will be useful for someone else too.