I have created a demo application with the sbt android-plugin.
The app is very simple.
I have placed a MainActivity.java
file under /src/main/java/my/package/
and when a button is pressed it takes you to a second Activity
but done in Scala
.
Everything is working fine but the build times are killing me. When I modify something I run in my device using:
> android:package-debug
> android:start-device
My issue is that it takes almost a complete minute to build a two activities project. Is there another way to compile and run?
This is my output of android:package-debug
> android:package-debug [info] Wrote /Users/macarse/Documents/demo/target/src_managed/main/scala/my/package/TR.scala [info] Compiling 1 Scala source to /Users/macarse/Documents/demo/target/scala-2.9.0-1/classes... ProGuard, version 4.6 ProGuard is released under the GNU General Public License. You therefore must ensure that programs that link to it (scala, ...) carry the GNU General Public License as well. Alternatively, you can apply for an exception with the author of ProGuard. Reading program directory [/Users/macarse/Documents/demo/target/scala-2.9.0-1/classes] Reading program jar [/Users/macarse/.sbt/boot/scala-2.9.0-1/lib/scala-library.jar] (filtered) Reading library jar [/Users/macarse/Documents/android-sdk-mac_86/platforms/android-4/android.jar] Note: You're ignoring all warnings! Preparing output jar [/Users/macarse/Documents/demo/target/classes.min.jar] Copying resources from program directory [/Users/macarse/Documents/demo/target/scala-2.9.0-1/classes] Copying resources from program jar [/Users/macarse/.sbt/boot/scala-2.9.0-1/lib/scala-library.jar] (filtered) [info] Dexing /Users/macarse/Documents/demo/target/classes.dex [info] Packaging /Users/macarse/Documents/demo/target/demo-0.1.apk [success] Total time: 56 s, completed Oct 29, 2011 4:22:54 PM
There are a couple of options:
There is also a project called treeshaker for Eclipse which is a lot faster than proguard, but it is not integrated w/ the sbt plugin yet.
It takes long time because proguard need to process Scala standard library to minimize the .apk file you get, and Scala standard library is huge.
I will suggest you switch to Scala 2.8 if you didn't use features of Scala 2.9, because 2.8 has a smaller standard library.
In the other hand, don't use android:package-debug
when not necessary. compile
will compile your source code, it is sufficient if you only want to make sure your program could be compiled.
Only use android:package-debug
when you are about to test it on the Android device, this will save your time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With