使用dx.bat时坏的类文件法宝 [英] Bad class file magic when using dx.bat
问题描述
我需要使用命令行,当我到达,我必须使用dx.bat转换成Dalvik的字节code点建立我的Android应用程序
I need to build my Android application using the command line, when I get to the point that I must use dx.bat to convert to Dalvik bytecode
dx.bat --dex --output=C:/local_programs/testProject/bin/classes.dex C:/local_programs/testProject/bin/classes/test/Android/cmd/
这条路。C:/ local_programs / TestProject的/ bin中/班/测试/安卓/ CMD /就是我的.class是
This path "C:/local_programs/testProject/bin/classes/test/Android/cmd/" is where my .class are.
它给了我这个错误
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing AndroidTestActivity.class
...while processing AndroidTestActivity.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R$attr.class
...while processing R$attr.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R$drawable.class
...while processing R$drawable.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R$id.class
...while processing R$id.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R$layout.class
...while processing R$layout.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R$string.class
...while processing R$string.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing R.class
...while processing R.class
7 warnings
no classfiles specified
我的.class产生,因为他们应该,而据我所知,他们没有损坏。
My .class are generated as they should, and as far as I can tell, they're not corrupted.
我发现这个问题的几个实例,但他们都不适合我的设置,因为我不使用的build.xml(我的理解是蚂蚁建造者)
I found several instance of this problem, but none of them fit my settings since I don't use build.xml (which I understand is a ant builder)
我的问题是:我有一个选择使用Ant或不
My questions is : Do I have a choice in using ant or not ?
推荐答案
您的类需要使用JDK 5或6,您可能正在使用7.如果还是不行编译,你可能还需要确认每一个类编译正确的,即使在不同的项目。解决我的问题<一href="http://stackoverflow.com/questions/8748977/android-emulator-crash-dx-bad-class-file-magic-classnotfoundexception-on-st">here.
Your classes need to be compiled with jdk 5 or 6. You are probably using 7. If that doesn't work, you might also need to make sure that every single class is compiled right, even if in different projects. Solved my problem here.
这篇关于使用dx.bat时坏的类文件法宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!