android + scala + preinstalled scala libraries + d

2019-06-01 07:03发布

问题:

Final purpose of this feat: Use android device for development by fast compiling without needing to use proguard each single time (which causes huge delays)

First try is on Sony Ericsson Xperia Mini Pro

I have installed in it Cyanogenmod which is already rooted and the root checker app has verified it.

This is the app I used to embed Scala library 2.9.1 inside android device:
https://github.com/jbrechtel/Android-Scala-Installer
The lines uses-library android:name="scala_... are now included inside the AndroidManifest

After the above actions I did some minor changes inside "project/Build.scala" like this line: useProguard in Android := false,

I am probably missing something because after recompiling and executing android:start-device I got java.lang.ClassNotFoundException
which is the error you are expecting to get when you have not done the previous steps (rooting device and installing scala libraries inside device)

Any ideas are welcome! Thank you

PS: Intellij is the chosen IDE for the current project so eclipse and the relative plugins is not an option

回答1:

There is nothing wrong with what I have mentioned above!

BUT there is a command inside Android Scala Installer which requests the "/system" folder to be mounted as writable. Unfortunately this does not work on my gingerbread android phone and this might be the general case.

I simply commented out the operation of the mount /system as writable (and also the command mount /system as read only) and the libraries installed successfully!
Note that I set manually the permissions of /system as writable before installing libraries

In fact I forked the github repository and therefore you can find me implementation over here: https://github.com/pligor/scala-android-libs

To summarize. Yes the only alterations needed in your scala android source code is to set the settings in Build.scala file for proguard to be false and you include the uses <uses-library android:name="scala_... inside Android Manifest.