Friday, 28 December 2012

Error running aapt, resource does not already exist in overlay

I have added to strings.xml file definition for the new style.

<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">AppicationName</string>
<style name="SpinnerStyle" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:background">@android:color/transparent</item>

Android aapt started to show me the following error messages.

android_res\values\strings.xml:7: error: Resource does not already exist in overlay at 'SpinnerStyle'; use <add-resource> to add.
android_res\values\strings.xml:8: error: Resource at SpinnerStyle appears in overlay but not in the base package; use <add-resource> to add.
Error running aapt.exe (1)

Here is how to use <add-resource> tag.

To fix this thy need to add tag with the type and the name of desired resource. In my case resource type is "style", and the name is "SpinnerStyle". I have added this string just before the <style> tag, and everything worked.

<add-resource type="style" name="SpinnerStyle"></add-resource>


  1. This might help someone coming here for the same issue..

    Add the line - "LOCAL_AAPT_FLAGS := --auto-add-overlay" to your file no need to change your xml file

    1. can u please tell the path wehere we have to paste it and how

    2. can u please tell the path wehere we have to paste it and how

    3. In the project which got the error, you can find in log.
      I think

  2. This comment has been removed by the author.