title: Android JUnit Tests failing with java.lang.VerifyError
body: <p>Aloha,</p>
  
  <p>I've been following the guidelines here:</p>
  
  <p><a href="http://developer.android.com/resources/tutorials/testing/helloandroid_test.html" rel="nofollow">http://developer.android.com/resources/tutorials/testing/helloandroid_test.html</a></p>
  
  <p>To create some simple test cases for a new Android project.  The first few test cases were working fine, but now I am not able to get any tests to run.  Here is an example of the output I am getting:</p>
  
  <pre><code>    [2011-03-25 10:05:01 - application-tests] Android Launch!
  [2011-03-25 10:05:01 - application-tests] adb is running normally.
  [2011-03-25 10:05:01 - application-tests] Performing android.test.InstrumentationTestRunner JUnit launch
  [2011-03-25 10:05:01 - application-tests] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'GalaxyTabRunning2.3'
  [2011-03-25 10:05:02 - application-tests] Application already deployed. No need to reinstall.
  [2011-03-25 10:05:02 - application-tests] Project dependency found, installing: application
  [2011-03-25 10:05:03 - application] Application already deployed. No need to reinstall.
  [2011-03-25 10:05:03 - application-tests] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
  [2011-03-25 10:05:03 - application-tests] Collecting test information
  [2011-03-25 10:05:06 - application-tests] Test run failed: java.lang.VerifyError
  </code></pre>
  
  <p>The test case is very simple:</p>
  
  <pre><code>/**
   * Test case to test a null input parameter to the decode method.
   * 
   */
  public void testNullInputPerformCrcDecoding()
  {
      try
      {
          AppProtocolDecoder.performCrcDecoding(null);
          fail("Expected IllegalArgumentException to be thrown...");
      }
      catch (IllegalArgumentException expected)
      {
          assertTrue(expected instanceof IllegalArgumentException);
      }
      catch (ProtocolException ve)
      {
          fail("Unexpected VisiProtocolException occured: " + ve);
      }
  }
  
  AppProtocolDecoder.performCrcDecoding(null);
  </code></pre>
  
  <p>is a static method.  I've removed all the code from it so all it does, literally is return null.  The test always fails with the java.lang.VerifyError.</p>
  
  <p>This is under Android 2.3 using the Android JUnit Test runner in Eclipse.</p>
  
  <p>Any ideas?  I've tried recreating the test project and all sorts of permutations of code modifications.</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT (!): Logcat output:</p>
  
  <pre><code>D/AndroidRuntime(  919): Shutting down VM
  W/dalvikvm(  919): threadid=1: thread exiting with uncaught exception (group=0x40015560)
  E/AndroidRuntime(  919): FATAL EXCEPTION: main
  E/AndroidRuntime(  919): java.lang.VerifyError: com.company.h1s.androidserver.test.protocol.AppProtocolDecoderTest
  E/AndroidRuntime(  919):    at java.lang.Class.getDeclaredConstructors(Native Method)
  E/AndroidRuntime(  919):    at java.lang.Class.getConstructors(Class.java:490)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping$TestCasePredicate.hasValidConstructor(TestGrouping.java:226)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping$TestCasePredicate.apply(TestGrouping.java:215)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping$TestCasePredicate.apply(TestGrouping.java:211)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping.select(TestGrouping.java:170)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping.selectTestClasses(TestGrouping.java:160)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:154)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:115)
  E/AndroidRuntime(  919):    at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:103)
  E/AndroidRuntime(  919):    at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:360)
  E/AndroidRuntime(  919):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3210)
  E/AndroidRuntime(  919):    at android.app.ActivityThread.access$2200(ActivityThread.java:117)
  E/AndroidRuntime(  919):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:966)
  E/AndroidRuntime(  919):    at android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime(  919):    at android.os.Looper.loop(Looper.java:123)
  E/AndroidRuntime(  919):    at android.app.ActivityThread.main(ActivityThread.java:3647)
  E/AndroidRuntime(  919):    at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(  919):    at java.lang.reflect.Method.invoke(Method.java:507)
  E/AndroidRuntime(  919):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  E/AndroidRuntime(  919):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  E/AndroidRuntime(  919):    at dalvik.system.NativeStart.main(Native Method)
  W/ActivityManager(   61): Error in app com.company.h1s.androidserver running instrumentation ComponentInfo{com.company.h1s.androidserver.test/android.test.InstrumentationTestRunner}:
  W/ActivityManager(   61):   java.lang.VerifyError
  W/ActivityManager(   61):   java.lang.VerifyError: com.company.h1s.androidserver.test.protocol.AppProtocolDecoderTest
  I/ActivityManager(   61): Force stopping package com.company.h1s.androidserver uid=10031
  I/Process (   61): Sending signal. PID: 919 SIG: 9
  D/AndroidRuntime(  911): Shutting down VM
  </code></pre>
  
  <p>I am using Maven for class dependencies.  Here are the libraries I am including via Maven:</p>
  
  <pre><code>/.m2/repository/com/google/android/android/2.2.1/android-2.2.1.jar
  /.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
  /.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar
  /.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar
  /.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
  /.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar
  /.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar
  /.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar
  /.m2/repository/org/json/json/20080701/json-20080701.jar
  /.m2/repository/org/slf4j/slf4j-android/1.6.1-RC1/slf4j-android-1.6.1-RC1.jar
  /.m2/repository/org/slf4j/log4j-over-slf4j/1.6.1/log4j-over-slf4j-1.6.1.jar
  /.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
  /.m2/repository/org/apache/mina/mina-core/2.0.0/mina-core-2.0.0.jar
  /.m2/repository/com/company/app-common/1.0-SNAPSHOT/app-common-1.0-SNAPSHOT.jar
  /.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
  /.m2/repository/com/company/app-data/1.0-SNAPSHOT/app-data-1.0-SNAPSHOT.jar
  /.m2/repository/org/springframework/spring/2.5.6/spring-2.5.6.jar
  </code></pre>