android - unable to set vector drawable on KITKAT -


i using vector drawable,it causes exception on api 19

android.content.res.resources$notfoundexception: resource id  

in gradle have added vectordrawables.usesupportlibrary = true in defaultconfig.

this code doesn't work version:

    imageview imageview = (imageview) view.findviewbyid(com.yarolegovich.lovelydialog.r.id.ld_icon); imageview.setimageresource(r.drawable.ic_my_location_black_24dp); 

make sure u have gradle version 2.0 or above if not add along current gradle configs build.gradle

 android {      defaultconfig {        generateddensities = []     }      // handled 2.0+ gradle plugin     aaptoptions {       additionalparameters "--no-version-vectors"     }    }  

and use app:srccompat="@drawable/ic_add" in imageview


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -