Android:在 res 中使用 SVG 会导致错误:“文件名必须以 .xml 或 .png 结尾" [英] Android: Using SVG in res leads to error: "The file name must end with .xml or .png"

查看:35
本文介绍了Android:在 res 中使用 SVG 会导致错误:“文件名必须以 .xml 或 .png 结尾"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了 Android Studio 1.2.1.1,现在 gradle 在我的资源文件夹中遇到了 svg 问题.我一直在毫无问题地使用 SVG,我希望它们将来会被允许".

I just updated Android Studio 1.2.1.1 and now gradle got problems with svg in my resources folder. I was always using SVGs with no problem and I hope they will be "allowed" in the future.

:app:mergeDebugResources
:app:mergeDebugResources FAILED
/home/petergriffin/folder1/another-app/MyAwesome-App/app/src/main/res/drawable-hdpi/logo.svg
Error:Error: The file name must end with .xml or .png
Error:Execution failed for task ':app:mergeDebugResources'.
> /home/petergriffin/folder1/another-app/MyAwesome-App/app/src/main/res/drawable-hdpi/logo.svg: Error: The file name must end with .xml or .png
Information:BUILD FAILED

任何想法如何解决这个问题?

Any ideas how to solve that ?

推荐答案

drawable资源目录下的webp文件同样的问题.

Same problem with webp files in the drawable resource directory.

最新的 gradle 插件 (v1.2.3) 无法识别一些以前可以使用的图像格式.切换回 v1.2.2 时没有问题

The latest gradle plugin (v1.2.3) is not recognizing some of the image formats that used to work before. I don't have the issue when I switch back to v1.2.2

更新:鉴于此功能已修复,您应该升级到最新的 gradle 插件版本,而不是恢复原状.

UPDATE: Given that this feature was fixed, you should upgrade to the latest gradle plugin release instead of reverting back.

您可以通过设置更改 build.gradle 中的版本:

You can change the version in your build.gradle by setting:

buildscript {

  repositories {
      jcenter()
      mavenCentral()
      // mavenLocal() // Only if you want to use your local maven repo
  }

  dependencies {
      // classpath 'com.android.tools.build:gradle:+'
      classpath 'com.android.tools.build:gradle:1.2.2'
  }
}

这篇关于Android:在 res 中使用 SVG 会导致错误:“文件名必须以 .xml 或 .png 结尾"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆