Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

synchronized block - Rejecting class because it failed compile-time verification Android

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

java.lang.VerifyError: Rejecting class com.sample.BufferManagerImpl because it failed compile-time verification (declaration of 'com.sample.BufferManagerImpl' appears in /data/app/com.sample.myapp-1/base.apk)

It only fails on devices using the ART virtual machine, but not on Dalvik

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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) {
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...