WHAT IS GRADLE?
Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins.
Now we will discus Gradle generates APK file. Before jump it's build system , we need to know APK File lifecycle.
APK File lifecycle
Simple Example: An image has thousands of pixels or An Image made with thousand of pixel
Now we will see how an APK build and run on our device.
Java class file from Java source file
Initially, Gradle compiles Java class from our source file with activity, fragment and other resources. at this moment it takes also our dependency, module, and the third-party libraries.
Here is the breakdown process:
- Source Compilation
- Dependency Resolution
- Class File Generation
- Packaging & Further Processing
.DEX file from Java class
After successfully building Java class now it's ready for the second step.
At this step Android SDK has a tool named dx. it converts Java class file to .dex file. dex full form is Dalvik Executable it means Dalvik virtual machine worker file. it optimizes our Java class file and makes it smaller. we will talk more about.Dex file in future.
Packaging into an APK or AAB
Android SDK has a tool named AAPT. AAPT full form is Android Asset Packaging Tool. it packages our optimized .dex file also our resources like image, icon, audio, video, and build a .apk file.
Now it's ready for debug or release?
of course NO.
Why is it not ready? we will see in the next part-(2)
Top comments (0)