2

Recently, I was hit by

Unable to execute dex: method ID not in [0, 0xffff]: 65536

I came across 2 code which able to measure number of methods in a dex

Both methods require me to have the generated dex file, in order to perform measurement.

But, what I can do, if I wasn't able to even generate the dex file, due to large number of methods?

Community
  • 1
  • 1
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875

1 Answers1

4

Under Linux environment

Grab all of the jar files

mkdir jars
cp **/*.jar jars

Iterate through them, displaying the method size

for file in jars/*.jar; do
  echo $file; ~/android-sdk/build-tools/17.0.0/dx --dex --output=temp.dex $file 2> /dev/null
  cat temp.dex| head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
done

Credit to http://betaful.com/post/82668814182/android-too-many-methods-dex-fails

Josh Bowden
  • 5,735
  • 2
  • 25
  • 36
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875