Android Studio — Project Structure : The details that matter…
This is yet another post on Studio , if you haven’t read my earlier one click here . Once you have made up your mind to either go for new creation or open up your existing app , you will be hooked to a standard structure which Studio provides.
You get to see below well laid structure in Studio
Let’s go one by one …
- app folder : The app folder or (app module folder) is generated as a default folder for your project work , you can more than one module in your entire project .
- build folder : The build folder resides under app folder , it contains the generated .class files from java , other intermediate files , final apk in output folder , files related to reports on code coverage if you perform unit / instrumentation testing as seen in below image.
3. libs folder : The libs folder is used to add external jars / aar files or jars / aar files generated by you from other project or same project but different module .
4. src folder : The src folder consists of many different directories and is considered the heart of application where developers do most of the interaction .
5. androidTest folder : The androidTest folder consists of files if you want to perform testing with regards to context and android emulator or devices comes into picture basically , it consists of testing files connected to android packages and not pure java (where tests can be carried out without emulator or device in picture).
6. java folder : The java folder consists of all files related to java coding like files related to activities, fragments , services , broadcast receivers etc .
7. res folder : The res folder contains files related to layouts (xml files) , values of strings, colors , styles , drawable images , vector images , anim folder for animation .
8. AndroidManifest.xml file : The AndroidManifest.xml file is kind of configuration file where all the activites , broadcast receivers, services , content provider is declared . Different permission used during app is declared in this file , meta-data & intent — filters also form part of manifest file . App name & app icon is declared .
9. test folder : The test directory holds tests. Unit tests, integration tests, functional tests and mock objects required for testing.
10 . App Level gradle file : The build.gradle file at app level contains all the dependencies , libraries , minimum api level , library info like maven , information of variants , version , signing configurations , testing level dependencies , proguard information . More info
11. Proguard-rules file : Android Applications are quite easy to reverse engineer, so if you want to prevent this from happening, you should use Proguard for its main function : Obfuscation. The other two important functions of Proguard are Shrinking and Optimization. Shrinking eliminates unused codes and its is highly useful. Optimization operates with java byte code, though, since Android runs on special bytecode which is converted from java bytecode some optimizations won’t work well.
12. Top level gradle file : It usually contains common configs for all modules . Whatever is included in this top-level gradle, it will affect all modules .
That’s it from me in this post , see you in next one .