Rob Anderson Rob Anderson - 5 months ago 401
Android Question

Android: Using SVG in res leads to error: "The file name must end with .xml or .png"

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 ?

Answer

Same problem with webp files in the drawable resource directory.

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

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'
  }
}
Comments