Reputation: 6697
I'm using IntelliJ IDEA 12.1.4, in my project I'm using few libraries/project:
I checkouted all projects from SVN and fixed dependencies or missing libraries, but when I try to make my project I'm getting all the time:
Android Dex: [Project name] Cannot create classes.dex file
No additional warnings/errors. This project works on 2 other computers but on my laptop it doesn't. I can't check Setting on other computers because I don't have access to them right now.
How can I fix this problem or get more details? I have no idea what is wrong. I tried:
Upvotes: 3
Views: 2440
Reputation: 3747
Found one solution that worked for me:
Remove "readonly" attribute from project folder and inner folders and files
Upvotes: 2
Reputation: 597
I took a look at the DX Wrapper code that is used by IntelliJ. That code can be viewed at GrepCode.
Taking a look at where the error is fired, shows the following code block.
String outFile = outputDir + File.separatorChar + "classes.dex";
if (new File(outFile).isFile()) {
// if compilation finished correctly, show all errors as warnings
messages.get(CompilerMessageCategory.WARNING).addAll(errors);
errors.clear();
}
else if (errors.size() == 0) {
errors.add("Cannot create classes.dex file");
}
The problem seems to be that the outputDir
doesn't have permissions to write the classes.dex. I went into my Project Structure
and changes the output path from /target/idea-classes
to just /target
and that worked like a charm.
Upvotes: 1
Reputation: 11
If you have artifacts in your project, then try remove it and then create again. I'm getting same error sometimes after compilation of signed apk
Upvotes: 1