Thanks, I'll give that a try. Is it only the case that you need a single project if you have a third party library? The reason I ask is that all of the blogs and discussions I have found about unit testing have advocated using two projects.
On Aug 5, 5:46 pm, "Fred Grott(shareme)" <fred.gr...@gmail.com> wrote: > You need to change from two project set up to having your tests under > tests/src in your main project. > > Remember, no test classes are packaged in apks, the dx tool is using a > back channel from emulator or device to your project folder. In which > case the 'extra' 3rd party library is causing problems in your > separate test project. > There are several blog posts with build script examples describing how > to do aone project setup to have both main code and tests..use Google > Search to find.. > > Fred Grotthttp://mobilebytes.wordpress.com > > On Aug 5, 10:29 am, Alex G <quixop...@googlemail.com> wrote: > > > Hi All, > > > I'm getting VerifyErrors when running unit tests. My tests are setup > > as a separate eclipse project which references the project I am > > testing. I have a class in my project which I use fairly heavily in my > > test project and this class is getting rejected by Dalvik. I had a > > look around and found > > this:http://groups.google.com/group/android-developers/browse_thread/threa.... > > I also have a third party jar on the build path of both the project > > under test and the test project. This causes no problems when running > > the project under test so I can't see why it should when running the > > test project, basically I'm stumped. > > > I have posted the error text below, MyProjectClass is a class in the > > project under test which is used fairly heavily in the test project. > > ThirdPartyInterface is an interface from a third party jar which is > > implemented by MyProjectClass. > > > W/dalvikvm( 969): Class resolved by unexpected DEX: > > Lmyproject.mypackage/android/data/MyProjectClass;(0x437359d0):0x1945e0 > > ref [Lmyproject.mypackage/ThirdPartyInterface;] Lmyproject.mypackage/ > > ThirdPartyInterface;(0x437359d0):0x18f2b0 > > I/dalvikvm( 969): Failed resolving Lmyproject.mypackage/android/data/ > > MyProjectClass; interface 410 'Lmyproject.mypackage/ > > ThirdPartyInterface;' > > W/dalvikvm( 969): Link of class 'Lmyproject.mypackage/android/data/ > > MyProjectClass;' failed > > W/dalvikvm( 969): VFY: unable to find class referenced in signature > > (Lmyproject.mypackage/android/data/MyProjectClass;) > > W/dalvikvm( 969): Class resolved by unexpected DEX: > > Lmyproject.mypackage/android/data/MyProjectClass;(0x437359d0):0x1945e0 > > ref [Lmyproject.mypackage/ThirdPartyInterface;] Lmyproject.mypackage/ > > ThirdPartyInterface;(0x437359d0):0x18f2b0 > > I/dalvikvm( 969): Failed resolving Lmyproject.mypackage/android/data/ > > MyProjectClass; interface 410 'Lmyproject.mypackage/ > > ThirdPartyInterface;' > > W/dalvikvm( 969): Link of class 'Lmyproject.mypackage/android/data/ > > MyProjectClass;' failed > > E/dalvikvm( 969): Could not find method > > myproject.mypackage.MyProjectClass.getName, referenced from method > > myproject.mypackage.MyTestCase.myTestMethod > > W/dalvikvm( 969): VFY: unable to resolve virtual method 1492: > > Lmyproject.mypackage/android/data/MyProjectClass.getName ()Ljava/lang/ > > String; > > W/dalvikvm( 969): VFY: rejecting opcode 0x6e at 0x000a > > W/dalvikvm( 969): VFY: rejected Lmyproject.mypackage/android/data/ > > MyTestCase.myTestMethod ()V > > W/dalvikvm( 969): Verifier rejected class Lmyproject.mypackage/ > > android/data/MyTestCase; > > D/AndroidRuntime( 969): Shutting down VM > > W/dalvikvm( 969): threadid=3: thread exiting with uncaught exception > > (group=0x4000fe70) > > E/AndroidRuntime( 969): Uncaught handler: thread main exiting due to > > uncaught exception > > E/AndroidRuntime( 969): java.lang.VerifyError: > > myproject.mypackage.MyTestCase > > E/AndroidRuntime( 969): at java.lang.Class.getDeclaredConstructors > > (Native Method) > > E/AndroidRuntime( 969): at > > java.lang.Class.getConstructor(Class.java: > > 484) > > E/AndroidRuntime( 969): at > > junit.framework.TestSuite.getTestConstructor(TestSuite.java:177) > > E/AndroidRuntime( 969): at junit.framework.TestSuite.<init> > > (TestSuite.java:59) > > E/AndroidRuntime( 969): at junit.runner.BaseTestRunner.getTest > > (BaseTestRunner.java:103) > > E/AndroidRuntime( 969): at android.test.AndroidTestRunner.getTest > > (AndroidTestRunner.java:124) > > E/AndroidRuntime( 969): at > > android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java: > > 52) > > E/AndroidRuntime( 969): at > > android.test.suitebuilder.TestSuiteBuilder.addTestClassByName > > (TestSuiteBuilder.java:81) > > E/AndroidRuntime( 969): at > > android.test.InstrumentationTestRunner.parseTestClass > > (InstrumentationTestRunner.java:368) > > E/AndroidRuntime( 969): at > > android.test.InstrumentationTestRunner.parseTestClasses > > (InstrumentationTestRunner.java:350) > > E/AndroidRuntime( 969): at > > android.test.InstrumentationTestRunner.onCreate > > (InstrumentationTestRunner.java:318) > > E/AndroidRuntime( 969): at > > android.app.ActivityThread.handleBindApplication(ActivityThread.java: > > 3601) > > E/AndroidRuntime( 969): at android.app.ActivityThread.access$2500 > > (ActivityThread.java:112) > > E/AndroidRuntime( 969): at > > android.app.ActivityThread$H.handleMessage > > (ActivityThread.java:1729) > > E/AndroidRuntime( 969): at android.os.Handler.dispatchMessage > > (Handler.java:99) > > E/AndroidRuntime( 969): at android.os.Looper.loop(Looper.java:123) > > E/AndroidRuntime( 969): at android.app.ActivityThread.main > > (ActivityThread.java:3948) > > E/AndroidRuntime( 969): at java.lang.reflect.Method.invokeNative > > (Native Method) > > E/AndroidRuntime( 969): at java.lang.reflect.Method.invoke > > (Method.java:521) > > E/AndroidRuntime( 969): at com.android.internal.os.ZygoteInit > > $MethodAndArgsCaller.run(ZygoteInit.java:782) > > E/AndroidRuntime( 969): at com.android.internal.os.ZygoteInit.main > > (ZygoteInit.java:540) > > E/AndroidRuntime( 969): at dalvik.system.NativeStart.main(Native > > Method) > > I/Process ( 604): Sending signal. PID: 969 SIG: 3 > > W/ActivityManager( 604): Error in app myapp running instrumentation > > ComponentInfo{myandroidtestpackage/ > > android.test.InstrumentationTestRunner}: > > W/ActivityManager( 604): myproject.mypackage.MyTestCase > > W/ActivityManager( 604): java.lang.VerifyError: > > myproject.mypackage.MyTestCase > > > Really grateful for any help, have been banging my head against this > > all day. > > > Cheers > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---