Periodically I get Exceptions reported on Android Market that aren't reproducible. The stack traces always begin like this:
at ... at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:143) at android.app.ActivityThread.main(ActivityThread.java:4306) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method)
ZygoteInit$MethodAndArgsCaller appears to be calling app methods directly instead of through code. How is this happening?
Finally reproduced one of these exceptions as follows: touch app icon, touch text field to bring up dialog, press Home, kill app pid, touch app icon, and press Back. Added saving and restoring of app instances variables in onSaveInstanceState and onRestoreInstanceState to fix problem.
Would still like to find description of ZygoteInit calls somewhere.
Zygote loads the core Java classes and performs initial processing of them. These classes can be reused by Android application and therefore this step makes them faster to start. Once the initial work of Zygote is done, the process listens to a socket and waits for requests.
init.rc starts the process "Zygote" via the program "/system/bin/app_process". Zygote loads the core Java classes and performs initial processing of them. These classes can be reused by Android application and therefore this step makes them faster to start.
Once the initial work of Zygote is done, the process listens to a socket and waits for requests. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.
Lars Vogel describes the role of the Zygote process during Android's start up in this article:
During startup of the Android system the Linux kernel first calls the process "init". init reads the files "/init.rc" and "init.device.rc". "init.device.rc" is device specific, on the virtual device this file is called "init.goldfish.rc".
init.rc starts the process "Zygote" via the program "/system/bin/app_process". Zygote loads the core Java classes and performs initial processing of them. These classes can be reused by Android application and therefore this step makes them faster to start. Once the initial work of Zygote is done, the process listens to a socket and waits for requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With