Android:在 res 中使用 SVG 会导致错误:“文件名必须以 .xml 或 .png 结尾"

2023-02-02移动开发问题
307

本文介绍了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 结尾"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何在 COCOS2d Android 中使用 CClistview?
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)...
2024-08-12 移动开发问题
5

cocos2d-android:如何显示分数
cocos2d-android: how to display score(cocos2d-android:如何显示分数)...
2024-08-11 移动开发问题
7

Sqlite 数据库未从资产文件夹 Android 复制
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)...
2024-04-15 移动开发问题
8

SQLite 数据库副本在由设备而不是模拟器生成时出现损坏
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)...
2024-04-15 移动开发问题
4

安卓文件拷贝
Android file copy(安卓文件拷贝)...
2024-04-15 移动开发问题
6

Android如何在android中检测Edittext的Copy事件
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)...
2024-04-15 移动开发问题
5