android.view.InflateException: Binary XML file line #0: Error inflating class ImageView报错


报错:PID: 6851  android.view.InflateException: Binary XML file line #0: Error inflating class ImageView



解决:

1、最外层布局添加: xmlns:app="http://schemas.android.com/apk/res-auto"


2、使用app:srcCompat 接收Vector

    


3、添加 vectorDrawables.useSupportLibrary = true

defaultConfig {
        。。。
        vectorDrawables.useSupportLibrary = true
    }





参考:https://chris.banes.me/2016/02/25/appcompat-vector/#enabling-the-flag





你可能感兴趣的:(Android)