Rejecting class because it failed compile-time verification Android

后端 未结 5 762
北海茫月
北海茫月 2020-12-11 03:25

One of my application suddenly fails on startup, with the following error message :

java.lang.VerifyError: Rejecting class com.sample.BufferManager

5条回答
  •  盖世英雄少女心
    2020-12-11 03:58

    The issue is due to having a synchronized block inside a try-catch block, for example :

    try {
        synchronized (mLock) {
            updateState();
        }
    } catch (IllegalStateException e) {
    }
    

    Apparently this is not a good practice, but as soon as I change it like this it works :

    synchronized(mLock) {
        try {
            updateState();
        } catch (IllegalStateException e) {
        }
    }
    

提交回复
热议问题