How can Android source code not have a main method and still run?

Each application will be having it’s own Virtual Machine. To run an app, within it’s space (VM), must have a main method.

Activities are not the actual classes to be invoked for start of application. There is a class called Application, which will be the root class for an application to be launched.

If there is no main method, how can a VM recognize how to start an app?

Framework has classes called Process, VMRuntime which are responsible for starting an application. Which indeed deal with main method.

For better understanding, study the Zygote service of Android. deals with Applicationmanager Service, ActivityStack Activity Threadds etc.

Leave a Comment