0

I have an important problem while compiling Android Application.

Using Windev Mobile, it generates java code, compile and create apk, however, when the apk creation, an error happens:

command line: "myjavapath\java.exe" -Xmx1024m -Djava.ext.dirs=.\platform-tools\lib -jar .\platform-tools\lib\dx.jar --dex --output "path\classes.dex" "path\classes" "path\libs"

returned error: Trouble writing output: No expanded opcode for 0004368d R.java:11@0001: invoke-direct v0:NffffLmynamespace/R$attr;, java.lang.Object.<init>:()v

Furthermore, R$attr in R.java contains nothing:

public static final class attr {
}

I assume there is a hard limit of 64k. But:

  • The R.java file contains only 364 lines, if these lines are fields/methods references, I'm very far away from 64k hard limit.
  • This error happened when I add a specific window, in my Windev Mobile project. Window that I'm using in another project without error.

So, what do you think it comes from? If you need any information, or document, no problem.

Thanks in advance.

PS: Maybe my english isn't perfect, I sorry for that.

Brandon
  • 16,382
  • 12
  • 55
  • 88
Jeelo
  • 63
  • 2
  • 9

1 Answers1

0

There are various limits in the dex file format. It looks like the one you are encountering is that there can't be more than 64k method references. This limit is for all classes in your dex file, not for just a single class.

The fact that the error is occurring on that class has nothing to do with the class itself, that's just that where it happened to hit the limit.

The only solution currently, is to reduce the size of your code, or to split some classes out into a separate dex file that you load dynamically.

JesusFreke
  • 19,784
  • 5
  • 65
  • 68