Title: Android 3.1 VerifyError
Tags: android
Question: I am running into a VerifyError after updating my Xoom to 3.1.  Here is the code that seems to be causing it.
public boolean goBack()
if(_overlay == null || _pdfView == null) return false;
_overlay.removeView(_pdfView);
_overlay = null;
_pdfView = null;
return true;
Where _overlay is a FrameLayout and _pdfView is a class for rendering PDF documents that extends RelativeLayout.  Here is the error that I get.
05-17 11:26:30.532: WARN/dalvikvm(14244): VFY: Ljava/lang/Object; is not instance of Landroid/view/View;
05-17 11:26:30.532: WARN/dalvikvm(14244): VFY: bad arg 1 (into Landroid/view/View;)
05-17 11:26:30.532: WARN/dalvikvm(14244): VFY:  rejecting call to Landroid/view/ViewGroup;.removeView (Landroid/view/View;)V
05-17 11:26:30.532: WARN/dalvikvm(14244): VFY:  rejecting opcode 0x6e at 0x000f
05-17 11:26:30.532: WARN/dalvikvm(14244): VFY:  rejected Lcom/bluediesel/shell/utils/JavaScriptInterface;.goBack ()Z
05-17 11:26:30.532: WARN/dalvikvm(14244): Verifier rejected class Lcom/bluediesel/shell/utils/JavaScriptInterface;
05-17 11:26:30.532: DEBUG/AndroidRuntime(14244): Shutting down VM
05-17 11:26:30.532: WARN/dalvikvm(14244): threadid=1: thread exiting with uncaught exception (group=0x401e2760)
05-17 11:26:30.542: ERROR/AndroidRuntime(14244): Caused by: java.lang.VerifyError: com.bluediesel.shell.utils.JavaScriptInterface
05-17 11:26:30.542: ERROR/AndroidRuntime(14244):     at com.bluediesel.shell.utils.BDWebViewClient.<init&gt;(BDWebViewClient.java:15)
05-17 11:26:30.542: ERROR/AndroidRuntime(14244):     at com.bluediesel.shell.view.BDWebView.<init&gt;(BDWebView.java:56)
05-17 11:26:30.542: ERROR/AndroidRuntime(14244):     at com.bluediesel.shell.view.BDWebView.<init&gt;(BDWebView.java:42)
05-17 11:26:30.542: ERROR/AndroidRuntime(14244):     ... 24 more
If I comment out the _overlay.removeView(_pdfView); line it works fine.  It's like it doesn't know that PdfView is a subclass of View.  PdfView is in a library.  Could that have anything to do with it?

Here is the accepted answer: Opcode 0x6e is "invoke-virtual", used for method invocation.  The message is being emitted by the code that validates the arguments being passed to the target method.
"Ljava/lang/Object; is not instance of Landroid/view/View;" suggests to me that a couple of types got merged, and the verifier couldn't find a common superclass below java.lang.Object.  (If it were complaining that "PdfView is not an instance of View", then I'd agree with your assessment that the VM didn't understand the class relationships.)
Can you paste in the disassembly of goBack()?  If you run "dexdump -d" on the APK it lives in and search for "com.bluediesel.shell.utils.JavaScriptInterface.goBack" you should jump right to it.  Just include the (20-ish?) lines of disassembled bytecode for the method.
Comment for this answer: CaseyB : from which to which version have you switched ?
Comment for this answer: I have no idea what happened.  It was giving me this error consistently even after a clean and rebuild, but I changed the version number and it started working!  I think it maybe because it cause Android to do some kind of clean out on the device, but I have no idea.  Either way I am going to give you the check mark for stepping up and know WAY more about this stuff that any person should! ;)


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2011:00:05/17/11', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<android>', 'Title': 'Android 3.1 VerifyError', 'ViewCount': 1282, 'id': 6033596, 'user_AboutMe': '<p>I am an Android and iOS Developer both professionally and as a hobby.  I also have a good deal of experience with C++, C# with a special interest in graphics and game programming.</p>\n', 'user_AccountId': 84482.0, 'user_DisplayName': 'CaseyB', 'user_Reputation': 24617.0, 'user_Views': 1768.0, 'user_id': 236136.0}}