AAPT : error : In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing


I have an error that I can't understand:

AAPT : error : In MenuView, unable to find attribute android:preserveIconSpacing

I'm not using any menus.

The project that I have should actually be an android lib, but as you can't have layout resources in a xamarin android lib, I used a workaround suggested on this forum. I created an xamarin android app and than manually edited the .csproj file to remove the "isApplication" tag.

I use the android support library v7 as a component.

Here are detailed logs:

Using "Aapt" task from assembly "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
1>Task "Aapt" (TaskId:71)
1>  Task Parameter:JavaPlatformJarPath=C:\Users\dev1-user\AppData\Local\Android\android-sdk\platforms\android-8\android.jar (TaskId:71)
1>  Task Parameter:ManifestFile=C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt\AndroidManifest.xml (TaskId:71)
1>  Task Parameter:PackageName=LB_AndroidGuiLib.LB_AndroidGuiLib (TaskId:71)
1>  Task Parameter:ResourceDirectory=obj\Debug\res\ (TaskId:71)
1>  Task Parameter:JavaDesignerOutputDirectory=C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt (TaskId:71)
1>  Task Parameter:ResourceOutputFile=C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt\resources.apk (TaskId:71)
1>  Task Parameter:AdditionalResourceDirectories=F:\projs\new lb\Lenting Biblio\LB_AndroidGuiLib\obj\Debug\__library_projects__\LB_AndroidLib\library_project_imports\res (TaskId:71)
1>  Task Parameter:ToolPath=C:\Users\dev1-user\AppData\Local\Android\android-sdk\build-tools\20.0.0\ (TaskId:71)
1>  Task Parameter:AdditionalAndroidResourcePaths=C:\Users\dev1-user\AppData\Local\Xamarin\Android.Support.v7.AppCompat\20.0.0\content\support/v7/appcompat (TaskId:71)
1>  Task Parameter:ApiLevel=8 (TaskId:71)
1>  Task Parameter:AndroidUseLatestPlatformSdk=False (TaskId:71)
1>  Aapt Task (TaskId:71)
1>    AssetDirectory:  (TaskId:71)
1>    ManifestFile: C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt\AndroidManifest.xml (TaskId:71)
1>    ResourceDirectory: obj\Debug\res\ (TaskId:71)
1>    JavaDesignerOutputDirectory: C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt (TaskId:71)
1>    PackageName: LB_AndroidGuiLib.LB_AndroidGuiLib (TaskId:71)
1>    UncompressedFileExtensions:  (TaskId:71)
1>    ExtraPackages:  (TaskId:71)
1>    AdditionalResourceDirectories:  (TaskId:71)
1>      F:\projs\new lb\Lenting Biblio\LB_AndroidGuiLib\obj\Debug\__library_projects__\LB_AndroidLib\library_project_imports\res (TaskId:71)
1>    AdditionalAndroidResourcePaths:  (TaskId:71)
1>      C:\Users\dev1-user\AppData\Local\Xamarin\Android.Support.v7.AppCompat\20.0.0\content\support/v7/appcompat (TaskId:71)
1>    AdditionalAndroidResourcePaths:  (TaskId:71)
1>      C:\Users\dev1-user\AppData\Local\Xamarin\Android.Support.v7.AppCompat\20.0.0\content\support/v7/appcompat (TaskId:71)
1>    LibraryProjectJars:  (TaskId:71)
1>    ExtraArgs:  (TaskId:71)
1>    CreatePackagePerAbi: False (TaskId:71)
1>  C:\Users\dev1-user\AppData\Local\Android\android-sdk\build-tools\20.0.0\aapt.exe package -f -m -M C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt\AndroidManifest.xml -J C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt --custom-package lb_androidguilib.lb_androidguilib -F C:\Users\dev1-user\AppData\Local\Temp\2pipq3le.rzt\resources.apk.bk -S obj\Debug\res -S "F:\projs\new lb\Lenting Biblio\LB_AndroidGuiLib\obj\Debug\__library_projects__\LB_AndroidLib\library_project_imports\res" -S C:\Users\dev1-user\AppData\Local\Xamarin\Android.Support.v7.AppCompat\20.0.0\content\support/v7/appcompat\res -I C:\Users\dev1-user\AppData\Local\Android\android-sdk\platforms\android-8\android.jar --auto-add-overlay --max-res-version 8  (TaskId:71)
1>  max res 8, skipping layout-v11 (TaskId:71)
1>  max res 8, skipping layout-v14 (TaskId:71)
1>  max res 8, skipping values-large-v14 (TaskId:71)
1>  max res 8, skipping values-v11 (TaskId:71)
1>  max res 8, skipping values-v14 (TaskId:71)
1>  max res 8, skipping layout-v11 (TaskId:71)
1>AAPT : error : In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing
1>  The command exited with code 1. (TaskId:71)

Thank you!


  • For all that may have the same problem.

    I solved it by deleting the line containing "android:preserveIconSpacing" from an a file some where in the location from logs.
    The exact file is in a sub folder at the location. You just have to do a text search for "android:preserveIconSpacing".

    I don't know if this is ok or not but it worked for me.

    In order to obtain so many logs as you can see in my other post, you need to set the output level in visual studio build to "diagnostic".
    This option is in Tools --> Options --> Projects and Solutions --> MSBuild project build output verbosity.

  • ChrisAtkinsonChrisAtkinson AUMember, University

    I fixed it by setting the Target Android Version to API Level 14.

  • ChrisAtkinsonChrisAtkinson AUMember, University

    The biggest issue I can see with that solution, is that you are modifying what appears to be a config file under Android.Support.v7.AppCompat on a particular machine. This may well work, but if someone else needs to build your App on another machine, then they will have to make the same change on their machine. Whereas, if you change the Target Version, then anyone else can build the App (assuming of course that they have the required Android SDKs etc installed)

Sign In or Register to comment.