2

We have a project where we use protobufs. When we count the number of methods in generated protobuf .java files they contain around 1000 methods. But when we compile them into a jar and use the method counter (Is there a way to get count of number methods used in a jar file) it shows up around 40000 methods.

I assume that every sub class which we have contains the same number of methods each super class has. But its just a guess. Is there any way I can compile those in a better way than this?.

This is not a single small project. So changing into other protobuf builders is not a solution. I assume there should be a better way of making jars.

Community
  • 1
  • 1
dinesh707
  • 12,106
  • 22
  • 84
  • 134
  • Why is number of methods a concern for you? – bobah Feb 04 '14 at 12:37
  • Android can only have around 65000, methods in whole project. When we add the protobufs it fails – dinesh707 Feb 04 '14 at 12:38
  • 2
    Are you using Maven? Would any of these do for you: http://stackoverflow.com/questions/6957760/exclude-unused-parts-of-dependencies-from-jar-maven http://stackoverflow.com/questions/8698814/configure-maven-shade-minimizejar-to-include-class-files ? – bobah Feb 04 '14 at 12:40

1 Answers1

0

Have a look at Exclude unused parts of dependencies from jar (Maven) and configure Maven Shade minimizeJar to include class files. They may well be what you need if you are using Maven to build your software.

Community
  • 1
  • 1
bobah
  • 18,364
  • 2
  • 37
  • 70