Thank you everyone for your replies.

I was able to resolve this error. As hinted above, the problem lied in
my project settings.
In my test project, instead of referencing project B directly, I was
able to export the class files from project A.
(Under the "Order and Export" tab in the "Java Build Path" pane.)

This gave me access to all the classes I needed in my test project.

Thanks again for everyone's help.

takashi


On 10月26日, 午前4:37, Ty <tseque...@hotmail.com> wrote:
> Exactly...
>
> Let me give you my example (and you can extrapolate it to your
> situation)
>
> I had project B that depends on project A (a set of exception classes
> exported as an external jar)
> Android Test project C called classes in project B and raised expected
> exceptions defined in project A (depending on project A as an external
> jar) which caught (as negative tests)
>
> When I ran these tests (as Android JUnit tests) I got the same (cross-
> loader)error
>
> I removed external jar dependency of A from project C and everything
> ran perfectly after that
>
> Regards
>
> Ty
>
> On Oct 19, 9:27 am, "Carl H." <charr...@gmail.com> wrote:
>
>
>
> > I get thiserroras well, I believe it depends on the order of imports
> > within your test project. If you have lib1 added to both the test and
> > tested project, you ll get something of that sort.... Still trying to
> > sort it out.
>
> > On Oct 14, 4:31 am, Brett Chabot <brettcha...@android.com> wrote:
>
> > > I'm not sure what that exacterrormessage means, but my guess is the
> > > problem has to do with your test to project mapping. An
> > > instrumentation (which is what your test project uses to access
> > > classes in your project under test), can only be targeted to one
> > > android application. Try splitting up your test project into
> > > ProjectATest and ProjectBTest, and see if that helps.
>
> > > Regards,
> > > Brett.
>
> > > On Wed, Oct 7, 2009 at 10:42 PM, takashi <t.hag...@gmail.com> wrote:
>
> > > > My application is seperated into three projects in eclipse.
> > > > The first one is a client Android Project called "Project A".
> > > > The second is a server Android Project called "ProjectB".
> > > > Lastly, I have "ProjectATest" for testing that has references
> > > > dependencies to "ProjectA" and "ProjectB".
>
> > > > When excuting InstrumentationTestRunner in "ProjectATest," I get the
> > > > followingerrormessage:
>
> > > > [2009-10-08 13:11:47 - ProjectATest]Launching instrumentation
> > > > android.test.InstrumentationTestRunner on device emulator-5554
> > > > [2009-10-08 13:12:01 - ProjectATest]Test run failed: cross-loader
> > > > access from pre-verified class
>
> > > > This is theerroras pulled from LogCat:
>
> > > > 10-08 04:11:44.089:ERROR/AndroidRuntime(760): Uncaught handler:
> > > > thread main exiting due to uncaught exception
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):
> > > > java.lang.IllegalAccessError: cross-loader access from pre-verified
> > > > class
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > org.gynoid.db.ClassMetadata.initRelation(ClassMetadata.java:181)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > org.gynoid.GynApplication.onCreate(GynApplication.java:41)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.app.Instrumentation.callApplicationOnCreate
> > > > (Instrumentation.java:1045)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.app.ActivityThread.handleBindApplication(ActivityThread.java:
> > > > 3622)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.app.ActivityThread.access$2500(ActivityThread.java:112)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1729)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.os.Looper.loop(Looper.java:123)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > android.app.ActivityThread.main(ActivityThread.java:3948)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > java.lang.reflect.Method.invokeNative(Native Method)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > java.lang.reflect.Method.invoke(Method.java:521)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> > > > (ZygoteInit.java:782)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> > > > 10-08 04:11:44.110:ERROR/AndroidRuntime(760):     at
> > > > dalvik.system.NativeStart.main(Native Method)
>
> > > > Has anyone been able to accomplish this or have any suggestions as to
> > > > what I am doing wrong?

-- 
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

Reply via email to