harjot-oberai / VectorMaster

Dynamic control over vector drawables!
MIT License
1.59k stars 161 forks source link

Exception during setContentView #19

Open LiTe1991 opened 6 years ago

LiTe1991 commented 6 years ago

Hi,

I want_ to try this lib, but I get an exception. Here is a cutout of the exception.

Caused by: android.view.InflateException: Binary XML file line #115: Error inflating class com.sdsmdg.harjot.vectormaster.VectorMasterView at android.view.LayoutInflater.createView(LayoutInflater.java:613) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270) at android.app.Activity.setContentView(Activity.java:1881) at de.ratiodata.scan4agree21.activity.TonerActivity.onCreate(TonerActivity.java:26) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)  at android.app.ActivityThread.access$600(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:5041)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)  at android.app.Activity.setContentView(Activity.java:1881)  at de.ratiodata.scan4agree21.activity.TonerActivity.onCreate(TonerActivity.java:26)  at android.app.Activity.performCreate(Activity.java:5104)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)  at android.app.ActivityThread.access$600(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:5041)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)  at dalvik.system.NativeStart.main(Native Method)  Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi-v4/image_toner_singeltoner.png from xml type xml resource ID #0x7f06006b at android.content.res.Resources.loadXmlResourceParser(Resources.java:2186) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2141) at android.content.res.Resources.getXml(Resources.java:902) at com.sdsmdg.harjot.vectormaster.VectorMasterView.buildVectorModel(VectorMasterView.java:86) at com.sdsmdg.harjot.vectormaster.VectorMasterView.init(VectorMasterView.java:75) at com.sdsmdg.harjot.vectormaster.VectorMasterView.<init>(VectorMasterView.java:51) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)  at android.view.LayoutInflater.createView(LayoutInflater.java:587)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)  at android.app.Activity.setContentView(Activity.java:1881)  at de.ratiodata.scan4agree21.activity.TonerActivity.onCreate(TonerActivity.java:26)  at android.app.Activity.performCreate(Activity.java:5104)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)  at android.app.ActivityThread.access$600(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:5041)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.io.FileNotFoundException: Corrupt XML binary file at android.content.res.AssetManager.openXmlAssetNative(Native Method) at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2168) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2141)  at android.content.res.Resources.getXml(Resources.java:902)  at com.sdsmdg.harjot.vectormaster.VectorMasterView.buildVectorModel(VectorMasterView.java:86)  at com.sdsmdg.harjot.vectormaster.VectorMasterView.init(VectorMasterView.java:75)  at com.sdsmdg.harjot.vectormaster.VectorMasterView.<init>(VectorMasterView.java:51)  at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)  at android.view.LayoutInflater.createView(LayoutInflater.java:587)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)  at android.app.Activity.setContentView(Activity.java:1881)  at de.ratiodata.scan4agree21.activity.TonerActivity.onCreate(TonerActivity.java:26)  at android.app.Activity.performCreate(Activity.java:5104)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)  at android.app.ActivityThread.access$600(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:5041)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)  at dalvik.system.NativeStart.main(Native Method) 

Can you say what it is or where is my mistake?

Best regards LiTe

darktiny commented 5 years ago

Same issue here, Android Gradle Plugin convert vector drawable xmls to png files when api level < 24, to resolve the issue, add below config line to your build.gradle

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}
priyamprakash commented 3 years ago

Same issue here, Android Gradle Plugin convert vector drawable xmls to png files when api level < 24, to resolve the issue, add below config line to your build.gradle

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

this did not work

HimaniT07 commented 3 years ago

Not working