XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0 XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0 android android

XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0


You can either switch back to the previous version of the appcompat library (Quick fix):

compile 'com.android.support:appcompat-v7:23.1.1'

Or keep the current library version and make the appropriate update to your build gradle file as explained by google in version 23.2.0 release note.

//for Gradle Plugin 2.0+  android {      defaultConfig {          vectorDrawables.useSupportLibrary = true      }  }

If you are using Gradle 1.5 you’ll instead use

defaultConfig {    generatedDensities = []}// This is handled for you by the 2.0+ Gradle PluginaaptOptions {    additionalParameters "--no-version-vectors"}

Don't forget to update your gradle build tool to version 1.5.0 at least or you couldn't use the new parameters like generatedDensities:

classpath 'com.android.tools.build:gradle:1.5.0'

More infos on why here


A previous answer to this question had a solution for developers who use Gradle, but I don't use Gradle so I want to summarize his answer which helped several people and what I eventually did. I accepted my own answer and not his since like I said, I don't use Gradle so I did not use what he wrote.

I did several things for it to work in the end. Possible solutions are:

First for Gradle users:

1) Revert the support library to an older version, since this one has a bug.

2) use compile 'com.android.support:appcompat-v7:23.2.1' as the bug was fixed there.

3) for Gradle Plugin 2.0:

android {      defaultConfig {          vectorDrawables.useSupportLibrary = true      }  }

Or you can use Grade Build Tools 1.5.0 (classpath 'com.android.tools.build:gradle:1.5.0')

defaultConfig {    generatedDensities = []}

// no need for this with Gradle 2.0

aaptOptions {    additionalParameters "--no-version-vectors"}

This is the part for non Gradle users:

1) Open SDK manager.

2) Uninstalled both "Android Wear X" (where X is ARM or Intel) from APIs 22 and 23.

3) I then still had a compilation error in one of the styles of the AppCompat library. I simply commented them out (I'll risk the very specific device not working if it uses that very specific style).

After that I cleaned the project and it just started to work.


For new users only, this problem is fixed in:

compile 'com.android.support:appcompat-v7:23.2.1'