javaandroidscalasbtsbt-android-plugin

Error when running sbt install-emulator


I am following the video on this page http://zegoggl.es/2009/12/building-android-apps-in-scala-with-sbt.html which use SBT to create an Android project. However I get to the point of trying to install the emulator using

sbt install-emulator

And I get the following error:

    [info] Nothing to compile.
    [info]   Post-analysis: 1 classes.
    [info] == tests / compile ==
    [info]
    [info] == awesomepad / proguard ==
    ProGuard, version 4.4
    ProGuard is released under the GNU General Public License. The authors of all
    programs or plugins that link to it (sbt, ...) therefore
    must ensure that these programs carry the GNU General Public License as well.
    Reading program directory [C:\Projects\Scala\sbt2test\awesomepad\target\scala_2.
    9.1\classes]
    java.io.IOException: Can't read [proguard.ClassPathEntry@550a17fb] (Can't proces
    s class [com/kickass/awesomepad/R$attr.class] (Unsupported version number [51.0]
     for class format))
            at proguard.InputReader.readInput(InputReader.java:230)
            at proguard.InputReader.readInput(InputReader.java:200)
            at proguard.InputReader.readInput(InputReader.java:178)
            at proguard.InputReader.execute(InputReader.java:78)
            at proguard.ProGuard.readInput(ProGuard.java:195)

Solution

  • I had the same issue. I realized it was because I was using JDK 1.7. Though jars created with 1.6 work on 1.7, proguard for 1.6 jars does not work with 1.7 jars. Currently, only beta releases of Proguard are available for 1.7. So, android tools and maven repositories have proguard for 1.6 jars. When it tries to trim 1.7 jars, it throws that error.

    To solve this problem, I downgraded to JDK 1.6, uninstalled 1.7 and made sure my jars are created by 1.6 JDK tools.

    To remove 1.7 jars from local repository, I just deleted the directories under ~/.ivy2 and re-created the android project using the plugin. And I just followed the README for the android plugin to the tee.