Vector drawable does not work as placeholder image on API 17 (and probably below API 21)
- Dominant language
- Kotlin
- Stars
- 17.2k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I have a `SimpleDraweeView` and a vector drawable XML. I tried to use the said XML as a placeholder in the Drawee but on API 17 (so probably below API 21) could not inflate the view and crashed the app.
[`AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)`](https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate.html#setCompatVectorFromResourcesEnabled(boolean)) does not seem to be a viable option as
> This feature defaults to disabled, since enabling it can cause issues with memory usage, and problems updating Configuration instances.
### Reproduction
Define the layout XML for the Drawee:
```xml
```
where `@drawable/ic_image_white_24dp` is `ic_image_white_24dp.xml`:
```xml
```
Note that the `SimpleDraweeView` has an `app:imageUri` attribute this is here because the data binding would not work otherwise, the implementation is pretty simple (it is not relevant to the bug though):
```java
@BindingAdapter({"imageUri"})
public static void loadImage(SimpleDraweeView view, Uri imageUrl) {
view.setImageURI(imageUrl);
}
```
The layout gets inflated by `DataBindingUtil` from a `RecyclerView.Adapter` located in a (support) `Fragment` that is attached to the parent `AppCompatActivity`.
The gradle file contains the necessary line for supporting vector drawables on lower API levels:
```gradle
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
```
### Additional Information
* Fresco version: 1.3.0
* Platform version: API 17, HTC One X
* Support lib version: 25.3.1
Contributor guide
Assessment
This issue has not been assessed yet.