简体   繁体   English

Android 资产名称必须以.xml结尾

[英]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.所以我正在尝试构建一个 android 库,在它的res/assets文件夹中,我有一些生成的 JSON 库使用的文件。 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?我最近没有对此文件进行任何更改,所以我不确定为什么它停止工作 - 关于如何解决这个问题的任何想法?

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.您不能将assets目录放入正在处理的res目录中……但只能放在它们旁边(在目录结构中的同一级别上),这样它们就不会被处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM