What Is .flat Extension? | .flat Files In Android Studio

While working on Android Studio, you must have noticed a large number of files are automatically generated when building an application. These files are stored inside the \app\build\intermediates\res\merged\release folder and they end with the .flat extension.

.flat extension files

These files that end with the .flat extension, are basically intermediate binary files which are created from the raw resource files of the android app that you are developing.

The .flat files are created by AAPT2 compiler of the Android Studio.

The AAPT2 compiler of the Android Studio supports the compilation of all types of files that are required as resources for building an android app. Thus, whenever you hit the Build button in Android Studio, it creates intermediate binary versions of all the resources of your app and stores them in .flat format, to be used while building the APK.

Here’s a table that shows how the output file type of certain files can change, depending on their raw formats.

INPUT TYPEOUTPUT TYPE
XML RESOURCE FILESRESOURCE TABLE WITH .*.arsc.flat EXTENSION
OTHER RESOURCE FILESPNG FILES ARE CONVERTED TO *.png.flat. OTHER FILES ARE CONVERTED TO *.flat INTERMEDIATE XML BINARY FILES.

For further information regarding the AAPT2 Compiler and the whole compilation process, please check out this page: https://developer.android.com/studio/command-line/aapt2

I hope this article helped you get a better understanding of .flat file extensions. Link to it from relevant sources and share it with your developer friends to make them aware of it!




Have a great day ahead!

About Anirban Roy

Anirban Roy is the founder of TechRBun. He is a Computer Geek. He likes to share his knowledge about PC, Mobiles and Blogging. He studies in class XII and when he is not studying, he can always be found tweaking his PC or surfing the web on his mobile phone. He loves music and literature too!

Leave a Comment