tags:

views:

138

answers:

3

I have two android projects, ProjA requires ProjB (in Eclipse Properties > Java Build Path > Projects > Add > ProjB). Every thing compiles ok in Eclipse, but when I run ProjA I get an error:

Could not find method XXX, referenced from method YYY.

Where XXX - is the method from ProjB.

How can I fix the settings?

A: 

Combine the two projects into one.

Or, have ProjB build a JAR file that ProjA includes.

Or, turn ProjB into a remote Service, with the method in question exposed via AIDL, and have ProjA bind to that service to use the method.

CommonsWare
A: 

You may want to look at your design, if you don't want to go with the answer by CommonsWare.

For example, you could call the second project from the first by using Intents, for example.

If there is code that is common to the two projects then you may want to pull that into a new project where you can include the files directly into both projects, but if the two are supposed to work together there are different ways in Android to allow Activities to call each other, or to pass information, and you may want to look at those.

James Black
+1  A: 

Don't know if this addresses the specific use case, but the Android SDK tools, as of r6, support Library Projects:

The SDK Tools now support the use of library projects during development, a capability that lets you store shared Android application code and resources in a separate development project. You can then reference the library project from other Android projects and, at build time, the tools compile the shared code and resources as part of the dependent applications. More information about this feature is available in the Developing in Other IDEs document.

Roman Nurik