Quinn
Quinn

Reputation: 9434

Android asset name must end in .xml

So I'm trying to build an android library, in its res/assets folder i have a few generated JSON files that the library uses. I've had these files here for months and have never had issues from them. Today I started getting this issue when building the library:

AGPBI: {"kind":"error","text":"The file name must end with .xml","sources":[{"file":"/Users/***/app/src/main/res/assets/data.json"}],"tool":"Resource and asset merger"}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> /Users/***/app/src/main/res/assets/data.json: Error: The file name must end with .xml

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
7 actionable tasks: 2 executed, 5 up-to-date

I haven't made any changes to this file recently so I'm not sure why this stopped working - Any ideas as to how to fix this?

Upvotes: 1

Views: 598

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76669

You cannot put the assets directory into the res directory, which is being processed ...but only beside them (on the same level within the directory structure), so that they won't get processed.

Upvotes: 3

Related Questions