Does reducing number of .java files reduces apk size?
For example is it better that i define my ListAdapter
inside Activity
class rather than a separate .java file?
shape.xml
and reference it in selector.xml
or define that shape inside the item
of selector?
Not in general.
That might save a handful of bytes.
Then reduce your APK size:
Get rid of libraries where you are using tiny pieces of them, and use the minimum possible library set (e.g., specific pieces of Play Services, not the whole "kitchen sink" Play Services library)
Reduce the number of density variants of your drawables, if in testing the automatic resampling by Android meets your needs, and use Lint to identify resources that might be lingering in your project that you are not referencing
Use ProGuard
Use
minifyResources
andresConfigs
options in your Gradle build file, if you are using Android StudioAnd everything else Cyril Mottier points out in that blog post