{"id":20469890,"url":"https://github.com/svenwiegand/scala-libs-for-android-emulator","last_synced_at":"2025-04-13T10:36:18.345Z","repository":{"id":4673562,"uuid":"5819900","full_name":"svenwiegand/scala-libs-for-android-emulator","owner":"svenwiegand","description":"Script for preinstalling the scala libraries on an android emulator to reduce turn around times.","archived":false,"fork":false,"pushed_at":"2015-07-24T21:37:01.000Z","size":12557,"stargazers_count":16,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T02:02:27.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svenwiegand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-15T12:08:50.000Z","updated_at":"2021-03-19T20:40:20.000Z","dependencies_parsed_at":"2022-09-25T02:02:11.860Z","dependency_job_id":null,"html_url":"https://github.com/svenwiegand/scala-libs-for-android-emulator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenwiegand%2Fscala-libs-for-android-emulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenwiegand%2Fscala-libs-for-android-emulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenwiegand%2Fscala-libs-for-android-emulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenwiegand%2Fscala-libs-for-android-emulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svenwiegand","download_url":"https://codeload.github.com/svenwiegand/scala-libs-for-android-emulator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248700144,"owners_count":21147778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T14:10:42.476Z","updated_at":"2025-04-13T10:36:18.318Z","avatar_url":"https://github.com/svenwiegand.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nscala-libs-for-android-emulator provides you an easy way to preinstall the scala libraries on your android emulator (from the SDK or genymotion), so\nto speed up your development as you do not need to include the scala libs into your debug builds then. I've tested this\nalso on current emulator images (ICS and Jelly Bean, either ARM or x86 with hardware accelerated emulation).\n\n**Disclaimer:** I've only tested the script on Windows, but it should also run on Mac OS X and other Unix-platforms.\n\n## The Problem\n\nIf you are -- like me -- tired of writing verbose Java code, but want to develop for the Android platform, then Scala is\na great choice. Unfortunately using the normal build process in conjunction with Scala is no good choice, as in each\nbuild the full scala libraries need to be processed, what takes quite a few minutes: You either have to feed the whole\nscala library to the `dx` tool (which converts java byte code to dalvik vm code) or the other choice is to use pro guard\nto remove all unreferenced artifacts, but this analysis requires some time.\n\n## The Solution\n\nBut there is a solution to bring down the turn around times to the same level as if you were using java: Preinstall\nthe scala libraries on your emulator, so that you can exclude them from your debug build (you will still need to include\nthem into your release!).\n\nI've found a few tutorials of how to modify the emulator's ramdisk and to include the scala libs into the `BOOTCLASSPATH`.\nThis worked fine for emulators up to API level 10 (android 2.3.3), but when I tried it on API level 15 (ICS) or\n16 (Jelly Bean) I've got a boot loop and the emulator never came up.\n\nWhile searching around in the web for a solution I've stumbled upon\n[jbrechtel's Android-Scala-Installer](https://github.com/jbrechtel/Android-Scala-Installer) which is an android app that\npreinstalls the scala libs on a rooted android device and uses another idea: Instead of modifying the `BOOTCLASSPATH`\nit installs the scala libs as system libraries which can then be used by your app using `\u003cuses-library /\u003e` statements\nin the `AndroidManifest.xml`. I've tried this on the emulator and voila: It was working.\n\nTo easily patch an emulator I then simply created this scala script which does everything for us -- from starting up\nthe emulator to installing the libraries, adjusting the system image and putting it into the right AVD directory.\nAll you need to do is to start the script and afterwards restart the emulator (cannot be automated on Windows).\n\nIf you are intersted in the details, of how this works, simply take a look into the scala script...\n\n# Usage\n\nUsing the script is easy:\n* Download the whole directory tree of this project to your system (either by cloning the repository or downloading it a ZIP)\n* Ensure that your `PATH` contains the scala compiler and the android tools\n* call the script without any parameters to get usage help and a list of available scala versions and AVDs:\n```\nscala install.scala\n```\n\nOn my system the output looks like this:\n```batch\nUSAGE: scala install.scala \u003cavd\u003e \u003cscala-version\u003e\n\nInstalls the scala libraries in the specified emulator to reduce turnaround\ntimes when developing with scala for android.\n\n\u003cavd\u003e            the name of the android virtual device to install the libs on\n                 possible values:\n                 4.0.3_HVGA, 4.1_HVGA, 4.2_Galaxy-Nexus\n\u003cscala-version\u003e  the scala version to install. possible values:\n                 2.10.1, 2.9.2\n```\n\n* Call the script with the adequate parameters and wait until it's done (what may take a few minutes)\n* Add the `\u003cuses-library /\u003e` statements outputed at the end of the script run to your `AndroidManifest.xml`\n* Enjoy developing android with scala!\n\n## Support for Genymotion emulator\n\nGenymotion is a great alternative to the standard emulator, as it is very fast and the images include Google play and all it's services. There is a dedicated script for installing scala into the currently running genymotion device: ```scala install-genymotion.scala```. The script requires that there is exactly one genymotion emulator currently running and that you configured genymotion for ADB usage. Call it without further paramters to retrieve usage help -- this script only requires you to specify the requested scala version.\n\n# Supported Scala Versions\n\nCurrently the script supports the following scala versions:\n* 2.9.2\n* 2.10.1\n\nIt is quite easy to support additional versions:\n* Copy your `scala-library.jar` and split it up into several smaller jars based on a package level, so that they can\n be processed using the `dx` tool.\n* Use the `dx` tool to convert each of the resulting JVM-JARs into Dalvik-JARs as followed:\n```batch\ndx -JXmx1024M -JXms1024M -JXss4M --no-optimize --debug --dex\n    --output=\\tmp\\scala\\android\\scala-library.jar \\tmp\\scala\\jvm\\scala-library.jar\n```\n* Clone an existing version directory inside the `scala` folder\n* Replace the JARs with your newly generated ones\n* Adjust the permission files for the version accordingly\n\nThat's it. **And please don't forget to provide me the new version, so that I can include it into the distribution here\nat GitHub**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenwiegand%2Fscala-libs-for-android-emulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvenwiegand%2Fscala-libs-for-android-emulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenwiegand%2Fscala-libs-for-android-emulator/lists"}