Invalid class when using dx.bat

I need to create an Android application using the command line when I get to the point that I have to 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/ 

This path "C: / local_programs / testProject / bin / classes / test / Android / cmd /" is where my .class is.

he gives me this error

 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 

My.class are generated as they should, and as far as I can tell, they are not damaged.

I found several instances of this problem, but none of them match my settings since I am not using build.xml (which I understand is the ant constructor)

My questions are: do I have a choice when using ant or not?

+4
source share
1 answer

Your classes should be compiled using jdk 5 or 6. You are probably using 7. If this does not work, you may also need to compile each individual class, even if in different projects. Solved my problem here .

+15
source

Source: https://habr.com/ru/post/1386758/


All Articles