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

查看:5913
本文介绍了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 ?

推荐答案

与可绘制资源目录中的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天全站免登陆