-AAPT indicates error about all files in folder animation

Shay Wilner 1,746 Reputation points
2025-12-02T20:46:07.4966667+00:00

Hello

I create a project for creating .net application for android. Also i add a subfolder named animation below Resources folder. In this folder i stored some xml files. When i build the project i get error

Error (active) APT2144 invalid file path 'C:\VISUAL STUDIO22\xamarin\knighttour\obj\Debug\net9.0-android\res\animation\turnzright.xml'.

knighttour	C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.78\tools\Xamarin.Android.Aapt2.targets	123	

Same error for each file in folder animation .The problem is not the files in folder animation.

And if i modify Build Action in properties of the file from Android Resource to None there is not error

Thanks

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Le (WICLOUD CORPORATION) 6,420 Reputation points Microsoft External Staff Moderator
    2025-12-11T03:25:26.9366667+00:00

    Hello @Shay Wilner ,

    I'm glad that you have solved the issue. I would like to add some additional information that might be helpful for others facing a similar problem.

    The AAPT2144 error you're seeing is caused by an invalid resource folder name. Android only recognizes specific folder names under the Resources directory, and animation is not one of them.

    This is not a Microsoft website, but it is official Android documentation that applies to all Android development.

    For animation files, you should use:

    • anim – for tween animations (rotate, scale, translate, etc.)
    • animator – for property animations (API level 11+)

    Try renaming your Resources\animation folder to Resources\anim or Resources\animator, depending on the type of animations you're using.

    You can find more details in the Default Resources documentation.

    Also, make sure your XML file names follow Android's naming rules: lowercase letters, numbers, and underscores only.

    After renaming, clean and rebuild your project.

    Additionally, since you're using .NET for Android, keep in mind that Xamarin is out of support. Consider migrating to MAUI for future projects, as it is the recommended framework moving forward.

    1 person found this answer helpful.
    0 comments No comments

  2. Q&A Assist
    2025-12-02T20:46:21.7+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error APT2144 you are encountering indicates that there is an invalid file path for the XML files located in the animation folder. This issue is often related to the file naming conventions or the structure of the resources in your Android project. Here are a few steps you can take to troubleshoot and resolve the issue:

    1. File Naming Conventions: Ensure that the XML files in the animation folder adhere to the naming conventions required by Android. The file names should only contain lowercase letters, numbers, underscores, or periods. Avoid using spaces or special characters.
    2. Folder Structure: Verify that the folder structure is correct and that the animation folder is properly recognized as a resource folder within your project. The animation folder should be directly under the Resources directory.
    3. Build Action: Since you mentioned that changing the Build Action from "Android Resource" to "None" removes the error, it suggests that the files may not be set up correctly as Android resources. Make sure the files are intended to be used as resources and are properly formatted.
    4. Clean and Rebuild: Sometimes, simply cleaning the solution and rebuilding the project can resolve path-related issues. Try cleaning the project and then rebuilding it to see if the error persists.
    5. Check for Other Errors: Look for any other errors in the build output that might give more context about what is causing the invalid path error.

    If the issue continues after checking these points, consider reviewing the Android documentation for more details on resource management and file structure requirements.


    References:

    0 comments No comments

  3. Shay Wilner 1,746 Reputation points
    2025-12-08T17:59:25.55+00:00

    You must named the animation folder "anim" otherwise Error (active) APT2144 is raised

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.