问题
I have a lot of unused images in my android app. Those images are placed in separate folder in project root directory. They are not being used anywhere in a project, but I need to keep them.
My concern is that will these unused images be included in the apk file? Since there are a lot of them and increase the size of apk file.
回答1:
Files stored in the root directory (including custom subdirectories) are not included in the APK. It is very common practice to have your own files needed for the project in the project root. For example, a source license file, a to-do list, a directory with high-resolution images that you create distributed images out of, etc.
Android uses these subdirectories with special meaning:
- src/
- res/
- assets/
- libs/
- gen/
- bin/
Using a subdirectory name other than those, Android will ignore your files.
回答2:
Confirm by your self: create the apk and change the extension to zip and extract that. You can use an apk optimizer like progaurd and more for same.
回答3:
addon to @Darshan-JosiahBarber s excellent answer
With android-studio-0.5.8, gradle-1.11 and android-tools.0.9.+ you can also have a folder
resources
for files to be copied relative to the root of the android apk.
Example:
- project file res/some/dir/file.txt will be copied to apk /res/some/dir/file.txt
- project file assets/some/dir/file.txt will be copied to apk /assets/some/dir/file.txt
- project file resources/some/dir/file.txt will be copied to apk /some/dir/file.txt
This folder resources
is necessary if you want to include *.properties
files used by crossplatform libs like ical4j.
来源:https://stackoverflow.com/questions/10927205/which-files-are-included-in-apk-file