Michael Edwards
Michael Edwards

Reputation: 6518

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)

Upvotes: 6

Views: 1308

Answers (5)

mikowiec
mikowiec

Reputation: 501

I've obtained error "(unsupported version number [51.0] for class format)" with java version "1.7.0_51".

This issue fixed by adding javac compatibility line to Build.scala:

val settings = Defaults.defaultSettings ++ Seq (
  ...
  javacOptions ++= Seq("-encoding", "UTF-8", "-source", "1.6", "-target", "1.6")
)

Upvotes: 0

Mikaël Mayer
Mikaël Mayer

Reputation: 10681

Because apparently the jdk1.7 is not compatible, I had the same problem. In my build.scala file, I added the following line:

javaHome := Some(file("c:\\Program Files\\Java\\jdk1.6.0_35"))

and then it worked.

Upvotes: 0

Salil
Salil

Reputation: 9722

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.

Upvotes: 4

Christian
Christian

Reputation: 4593

For me, the description on the plugins site was sufficient: link.

Have you tried to do it that way?

Upvotes: 0

Tupshin Harper
Tupshin Harper

Reputation: 1297

As the page that you link to says, "Note: this article hasn't been updated in a while and is out of date. In doubt refer to the README of the sbt-android-plugin." The readme there (README.md) contains the only set of instructions that I have been able to find that actually works with current versions of scala, sbt, and the Android SDK.

I had to make only minor tweaks to get it to work:

  1. Modify your sbt script (probably ~/bin/sbt) and add a "-XX:MaxPermSize=512m" parameter, otherwise you run out of PermGen space
  2. Make sure to use the 0.10 template (the default) instead of the 0.11 one that you can optionally specify.
  3. Make sure that you skip down to the "Hacking on the plugin" section when it tells you to.

Hope this helps.

Upvotes: 2

Related Questions