Search code examples
android-sourceandroid.mk

[AOSP]Update preloaded classes list


I created a java library that containing 3 classes,I added these class names in "/frameworks/base/config/preloaded-classes" for preloading. But in startup logcat showing following error.

W/Zygote: Class not found for preloading: com.example.my.lib.preloadlibshared.CalcUtil
W/Zygote: Class not found for preloading: com.example.my.lib.preloadlibshared.CompareUtil
W/Zygote: Class not found for preloading: com.example.my.lib.preloadlibshared.DrawUtil

My intention is to preload classes in my jar file.

Any clues on how to do it?


Solution

    1. Create a Android.mk for jar library to build your library to a module.
    2. Add your library module to PRODUCT_BOOT_JARS, and the value will be wrote into init.rc.
    3. Add your library module to PRODUCT_PACKAGES.
    4. Add your defined class to build/core/tasks/check_boot_jars/package_whitelist.txt to avoid the system check to your class.