-AAPT indicates error about all files in folder animation
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
-
Anonymous
Hi @Shay Wilner , sorry for bothering you, do you have any update on Michael's response? If you find his answer useful, please let me know! Thanks
Sign in to comment
3 answers
-
Michael Le (WICLOUD CORPORATION) 11,330 Reputation points • Microsoft External Staff • Moderator
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
Resourcesdirectory, andanimationis 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\animationfolder toResources\animorResources\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.
-
-
Shay Wilner 1,746 Reputation points
You must named the animation folder "anim" otherwise Error (active) APT2144 is raised
-
AI answer
The error APT2144 you are encountering indicates that there is an invalid file path for the XML files located in the
animationfolder. 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:- File Naming Conventions: Ensure that the XML files in the
animationfolder 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. - Folder Structure: Verify that the folder structure is correct and that the
animationfolder is properly recognized as a resource folder within your project. Theanimationfolder should be directly under theResourcesdirectory. - 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.
- 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.
- 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:
AI-generated content may be incorrect. Read our transparency notes for more information. - File Naming Conventions: Ensure that the XML files in the
