1

In my Android application that I'm currently developing, I have variables and methods for debugging purposes. If I don't use any of the variables or methods in the application, will they increase the application's size, or will the compiler notice that this code isn't used and therefore discard it?

4

1 回答 1

4

I'd better say not compiler, but obfuscation. Yes, it'll remove unused variables and other stuff. Check out the article about proguard, it contains lot of details.

Also, running at least Lint and fix all it's warnings before release will be also useful (haven't made any exact comparisons and tests regarding this, but not sure if obfuscation takes care e.g. about unused resource/redrawing etc. which also affects size and, more important, performance of the app).

于 2012-08-25T07:12:57.260 回答