2016/5/19

Preload resource warnning..

出現一堆 message:
W/Resources(  220): Preloaded drawable resource #0x10802a5 (android:drawable/dialog_top_holo_dark) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x10802a6 (android:drawable/dialog_top_holo_light) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x1080358 (android:drawable/ic_dialog_alert_holo_dark) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x1080359 (android:drawable/ic_dialog_alert_holo_light) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x1080496 (android:drawable/list_divider_holo_dark) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x1080497 (android:drawable/list_divider_holo_light) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x1080497 (android:drawable/list_divider_holo_light) that varies with configuration!!
W/Resources(  220): Preloaded drawable resource #0x10800c2 (android:drawable/ab_transparent_dark_holo) that varies with configuration!!

grep 一下,出自於:frameworks/base/core/java/android/content/res/Resources.java 2240,12 84%
    private boolean verifyPreloadConfig(int changingConfigurations, int allowVarying,
            int resourceId, String name) {
        // We allow preloading of resources even if they vary by font scale (which
        // doesn't impact resource selection) or density (which we handle specially by
        // simply turning off all preloading), as well as any other configs specified
        // by the caller.
        if (((changingConfigurations&~(ActivityInfo.CONFIG_FONT_SCALE |
                ActivityInfo.CONFIG_DENSITY)) & ~allowVarying) != 0) {
            String resName;
            try {
                resName = getResourceName(resourceId);
            } catch (NotFoundException e) {
                resName = "?";
            }
            // This should never happen in production, so we should log a
            // warning even if we're not debugging.
            Log.w(TAG, "Preloaded " + name + " resource #0x"
                    + Integer.toHexString(resourceId)
                    + " (" + resName + ") that varies with configuration!!");
            return false;
        }
        if (TRACE_FOR_PRELOAD) {
            String resName;
            try {
                resName = getResourceName(resourceId);
            } catch (NotFoundException e) {
                resName = "?";
            }
            Log.w(TAG, "Preloading " + name + " resource #0x"
                    + Integer.toHexString(resourceId)
                    + " (" + resName + ")");
        }
        return true;
    }

沒有留言:

張貼留言