0

I have written a simple J2ME app using Lwuit library, it is working good but my problem is that even my code is very small but the app size becomes 700kb means all the classes of lwuit gets included in my app though I am only using 5-6 of its classes. I have also tried Obfuscation with High level and app size decrease but still it is Big in size about 300kb(only for HelloWorld!). So please tell me any way to remove these unused classes and make this app smaller in size.

ssa
  • 199
  • 5
  • 13

2 Answers2

1

If you've done obfuscation properly (and it is pretty straight forward if you're using netbeans), then any unused classes will be removed. I would not recommend manually deleting the .class files because jar size is an important field in the jad and/or manifest files.

When you opened the jar, do you see a bunch of .class files?

Ian
  • 691
  • 3
  • 9
  • sorry for late reply, I think I have done obfuscation properly! Yes when I opened the jar there was bunch of classes like a.class,ab,.....z.class.So my original question is that just for HelloWorld program why there is 60-70 classes(a-z,aa-az,ba-bz)? It means it also including some unused classes, due to this, app size becomes 300kb(100kb for theme). – ssa Oct 18 '12 at 09:39
  • Are you using the LWUIT.jar? If so, kindly check out the LWUIT source code and reference it as a project in the build path. This way you build the LWUIT project as you build your helloworld program. But yeah, thinking about it more, I may have not tried this one, I almost always use the project reference before. – Ian Oct 22 '12 at 01:24
0

I suppose that you can open the .jar with some application like winRar and delete the .class that you will not use, but be carefull removing this .class.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • sorry for late reply, Actually I alredy tried this but after deleting any file The compler is giving Class Verify Error! Any other way to safely delete these classes? – ssa Oct 18 '12 at 09:46
  • The .jar what you are opening is the lwuit.jar, right? I think that you can delete some classes like 3D, etc – Mun0n Oct 18 '12 at 10:04
  • I tried deleting 3d,animation,tree....from the lwuit.jar and then imported it but it is giving class verification error ,I also tried deleting these classes from final jar but same error during execution on emulator. – ssa Oct 21 '12 at 18:31
  • Yes, this is expected. The size in the manifest files are important in JavaME that is why deleted .class files inside the jar directly is not an option. – Ian Oct 22 '12 at 01:21