Question

I need to build my android application from command line(I'm compiling the code using Java7), but when I try to create the dex file I get the following error

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing org/holoeverywhere/widget/TimePicker$OnTimeChangedListener.class
...while processing org/holoeverywhere/widget/TimePicker$OnTimeChangedListener.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing org/holoeverywhere/widget/TimePicker$SavedState$1.class
...while processing org/holoeverywhere/widget/TimePicker$SavedState$1.class

This is how I call dx.bat

dx --dex --output=bin/classes.dex bin/classes.jar

I have already seen the similar questions (Bad class file magic when using dx.bat, Dx bad class file magic (cafebabe) or version (0033.0000) with ADK14)

But the only solution gave in those questions is compiling our code using java6 Since I'm using ActionbarSherlock in my project, I have to use Java7 and I would like to know if by any chance there is a way to create the dex file from class files created by java7

After all IntelliJ is already doing it!

Was it helpful?

Solution

Well i found the solution here: http://www.informit.com/articles/article.aspx?p=1966023

I used the following arguments on my javac command, So the generated class files are suitable for Dx command,

javac -source 1.6 -target 1.6 ca/tutortutor/utils/Utils.java
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top