問題描述
我剛剛更新了 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 結尾"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!