使用DataBindingUtil.setContentView时出现异常'java.lang.VerifyError'

时间:2018-06-25 09:14:26

标签: android-studio android-databinding

当我使用DataBindingUtil.setContentView(Activity activity,int layoutId)时,出现了异常'java.lang.VerifyError'。但是在我添加一些我认为不会出错的代码之前,它运行良好。我已尝试解决此问题很多次,但我真的不知道为什么会收到此异常,下面有一些代码和异常信息:

mGrainBinding = DataBindingUtil.setContentView(this, R.layout.activity_store_grain);

例外信息

java.lang.VerifyError: Rejecting class com.honour.sampling.databinding.StoreGrainSampleinfoBindingLargeImpl because it failed compile-time verification (declaration of 'com.honour.sampling.databinding.StoreGrainSampleinfoBindingLargeImpl' appears in /data/app/com.honour.sampling-2/base.apk:classes2.dex)
    at android.databinding.DataBinderMapperImpl.getDataBinder(DataBinderMapperImpl.java:144)
    at android.databinding.DataBindingUtil.bind(DataBindingUtil.java:199)
    at android.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1212)
    at android.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1228)
    at android.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1228)
    at android.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1228)
    at android.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:679)
    at com.honour.sampling.databinding.StoreGrainActivityBinding.<init>(StoreGrainActivityBinding.java:84)
    at android.databinding.DataBinderMapperImpl.getDataBinder(DataBinderMapperImpl.java:351)
    at android.databinding.DataBindingUtil.bind(DataBindingUtil.java:199)
    at android.databinding.DataBindingUtil.bindToAddedViews(DataBindingUtil.java:327)
    at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:306)
    at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
    at com.honour.sampling.activity.task.StoreGrainActivity.getIntentArgs(StoreGrainActivity.java:188)
    at com.honour.sampling.activity.task.StoreGrainActivity.onCreate(StoreGrainActivity.java:162)
    at android.app.Activity.performCreate(Activity.java:6102)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
    at android.app.ActivityThread.access$1200(ActivityThread.java:165)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5593)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:968)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:763)

谁能帮助我,先谢谢!

0 个答案:

没有答案