运行 sbt install-emulator 时出错
我正在关注此页面上的视频 http:// /zegoggl.es/2009/12/building-android-apps-in-scala-with-sbt.html 使用 SBT 创建 Android 项目。但是,我尝试使用安装模拟器
sbt install-emulator
,但出现以下错误:
[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)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我有同样的问题。我意识到这是因为我使用的是 JDK 1.7。虽然使用 1.6 创建的 jar 可在 1.7 上运行,但 1.6 jar 的 proguard 不适用于 1.7 jar。目前,Proguard 1.7 仅提供 Beta 版。因此,android 工具和 Maven 存储库具有适用于 1.6 jar 的 proguard。当它尝试修剪 1.7 jar 时,它会抛出该错误。
为了解决这个问题,我降级到 JDK 1.6,卸载了 1.7,并确保我的 jar 是由 1.6 JDK 工具创建的。
为了从本地存储库中删除 1.7 jar,我刚刚删除了 ~/.ivy2 下的目录并使用该插件重新创建了 android 项目。我只是按照 Android 插件的自述文件进行操作。
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.
正如您链接到的页面所说,“注意:本文已经有一段时间没有更新并且已经过时。如有疑问,请参阅 sbt-android-plugin 的自述文件。”那里的自述文件(README.md)包含唯一的一组我已经找到了实际适用于当前版本的 scala、sbt 和 Android SDK 的说明。
我只需要做一些小的调整就可以让它工作:
希望这有帮助。
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:
Hope this helps.
对我来说,插件网站上的描述就足够了:链接。
你尝试过这样做吗?
For me, the description on the plugins site was sufficient: link.
Have you tried to do it that way?
因为显然jdk1.7不兼容,我也遇到了同样的问题。
在我的
build.scala
文件中,我添加了以下行:然后它就起作用了。
Because apparently the jdk1.7 is not compatible, I had the same problem.
In my
build.scala
file, I added the following line:and then it worked.
我收到错误“(类格式不支持的版本号 [51.0])”,java 版本为“1.7.0_51”。
通过向 Build.scala 添加 javac 兼容性行修复了此问题:
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: