3

I have been working on one project which is too complex and contain very much space with so many images and Java files as well.

Somewhere I have read about the proguard which optimizes the code.

I have used it, but it's still does not have an effect on my final APK file.

It might be I have made a mistake somewhere. I have the following this like http://developer.android.com/guide/developing/tools/proguard.html.

How can I optimize my code?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dharmendra
  • 7,835
  • 5
  • 38
  • 71

2 Answers2

2

You can add it to the default.properties. I've been adding manually without having a problem so far.

If you add the line:

proguard.config=proguard.cfg

As said it will only use ProGuard when exporting signed application (Android Tools => Export Signed Application)

If you start the project with the SDK before Android 2.3 the proguard.cfg file will not be created (next to default.properties as in 2.3>).

To enable automatic creation of it, just simply update to the SDK of Android 2.3 and create a new project with existing sources (which are the sources of the project you currently have).

Automagically the proguard.cfg fill will be created.

Without optimizations the compiler produces very dumb code - each command is compiled in a very straightforward manner, so that it does the intended thing. The Debug builds have optimizations disabled by default, because without the optimizations the produced executable matches the source code in a straightforward manner.

Android
  • 2,383
  • 1
  • 26
  • 44
Yog Guru
  • 2,074
  • 3
  • 28
  • 47
1

Please refer this one

From documentation:

ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode.

Community
  • 1
  • 1