Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Warning message: Attempt to retrieve bag which is invalid or in a cycle

Tags:

android

I see warning message in LogCat saying:

ResourceType: Attempt to retrieve bag 0x7f080015 which is invalid or in a cycle.

The warning message repeats 50+ times which is really annoying. What does it mean? And how do I make it go away?

like image 899
Xi 张熹 Avatar asked Apr 30 '12 17:04

Xi 张熹


2 Answers

The reason is that the project has a style defined under "values-fr" but no counterpart under the default values folder.

like image 180
Xi 张熹 Avatar answered Oct 30 '22 12:10

Xi 张熹


I was getting that message because I was using the following method to override my styles for different API levels:

<style name="ToolBar" parent="ToolBar.Base"/>

<style name="ToolBar.Base">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">?actionBarSize</item>
    <item name="android:background">@color/primary</item>
</style>

And then adding

<style name="ToolBar" parent="ToolBar.Base">
    <item name="android:elevation">4dp</item>
</style>

in my v21/styles file. It's the period between ToolBar and Base that's causing the problem. Replace that with an underscore or a different name with no period and you should be fine. For more on why, read what Android has to say about Style and Theme Inheritance.

Anyway, I changed ToolBar.Base to ToolBar_Base, and no more error messages.

like image 26
Jim Pekarek Avatar answered Oct 30 '22 14:10

Jim Pekarek