You should create jars for your libraries and include them in
project's Properties -> Java Build Path -> Libraries.
Hope this helps.

--
Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients

On Nov 18, 6:30 am, emitya <[email protected]> wrote:
> Hi,
>
> I have a question on the project set-up - this may be a bug in SDK.
>
> I cannot run android junit tests for classes sitting in main android
> project that implement interfaces that reside in other included
> projects. Depending on SDK version I get different errors: from "Test
> run failed:" on 1.5 and 1.6 and spurious process death to a more
> polite "NoClassDefFoundError" on SDK 2.0. This happens only on
> instantiation of classes that reside in the Android project and
> implement interfaces residing outside that android project. There is
> no problem instantiating classes that do not fall into this category
> (i.e. android only or library only classes).
>
> Android project by itself works fine with these classes - it is just
> the test set-up doesn't and project inclusion/classpath seems to be
> ok. Test project includes all projects that main project includes.
> NoClassDefFoundError makes little sense here given that the
> classloader can see and instantiate classes sitting right next to the
> ones that do not work.
>
> Did anyone else run into this or found a way to set-up android based
> tests in a multi-project set-up?
>
> Below is more detailed set-up and test explanation:
>
> 1)
> Library project: FooLib
> public interface IFoo {
> ...}
>
> public class FooImpl implements IFoo {
> ...
>
> }
>
> 2)
> Main project: AndroidFoo
> public class FooAndroidImpl implements IFoo {
> ...}
>
> public class Bar {
> ...
>
> }
>
> 3)
> Test Project: AndroidFooTest
> public class FooTester extends AndroidTestCase  {
>
>   // breaks
>   void test1AndroidImplWithInterfaceInLibraryProject() {
>      Object o = new FooAndroidImpl();   // Gets NoClassDefFoundError
> on SDK 2.0 and obscure "Test run failed" on 1.6 and 1.5
>    }
>
>   // works
>   void test2AndroidOnly() {
>      Object o = new Bar();   // works fine -> no exceptions even
> though the class sits in the same package as the one that was throwing
> exceptions in case 1
>    }
>
>   // works
>   void test3LibraryProjectOnly() {
>      Object o = new FooImpl();   // works fine -> no exceptions even
> though the class sits in the same package as interface of the test1
>    }
>
> }
>
> Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to