Android 网格视图转换为 Dalvik 格式失败错误
我跟随 Android 潮流并开始浏览谷歌的“查看”教程。这是我正在使用的: 日食伽利略 安卓 SDK 2.1 Java SDK 6.我的想法。
一切都很顺利,直到我接触了网格视图教程。当我开始编辑“HelloGridview.java”文件时,我到处都是错误。我以为我可以通过本教程的下一部分创建 ImageAdapter 类来修复它,但它创建了更多。我意识到我的很多问题可以通过导入教程中未提及的小部件(即 android.widget.GridView、.ImageView、.BaseAdapter 等)来解决。但是,在 eclipse 建议的所有协调之后,文件最终显示没有错误。我将它作为 Android 应用程序运行,然后“你的项目包含错误”。窗口出现。我创建的文件上没有显示任何错误。我清除了错误日志并关闭了 eclipse,然后再次启动,错误日志现在显示为:转换为 Dalvik 格式失败,错误 1。此时我有点迷失。我想我已经包含了所需的信息。如果您需要了解更多信息,请告诉我。
任何帮助表示赞赏。
I'm on the android bandwagon and started going through google's "view" tutorials. Here is what I'm using:
Eclipse Galileo
Android SDK 2.1
Java SDK 6.Something I think.
Everything was hunky-dory until I hit the grid view tutorial. I got errors all over the place when I started editing the "HelloGridview.java" File. I thought I'd fix it by following through with the next part of the tutorial, creating the ImageAdapter class, but it created more. I realized alot of my issues could be resolved by importing widgets which were not mentioned in the tutorial (i.e. android.widget.GridView, .ImageView, .BaseAdapter etc.) However, after all the reconciliation suggested by eclipse the files were finally showing no errors. I go to run it as an android app and bam, "Your project contains error(s)." window comes up. There are no errors showing on the files I've created. I cleared the error log and shut down eclipse and started again the error log now reads: Conversion to Dalvik format failed with error 1. I'm a little lost at this point. I think I've included the required information. If you need to know more let me know.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的问题。 Eclipse 在 java 构建路径中导入了一个 jar,这不知何故导致了错误。
右键单击项目 -> Java 构建路径并确保您只导入了一次 android.jar。
I had the same problem. Eclipse imported a jar in the java build path and this somehow caused the error.
Right Click o the project -> Java Build Path and make sure you have only once imported android.jar.
Android 开发者网站上的一些示例已经有点过时了,因此那些让您感到悲伤的示例可能不再是一个很好的示例。
尝试这个
GridView
示例肯定可以在当前版本的 Android 上运行。Some of those examples on the Android developer site are a trifle out of date, and so it may be that the one giving you grief is no longer a great example to work from.
Try this
GridView
sample for something that definitely works on current versions of Android.