Javier Sedano
Javier Sedano

Reputation: 953

Build path errors with library projects

I've just upgraded my Android dev env up to v15 and I'm unable to reference library projects. I have a project AppCore and another project App. AppCore is a library project (properties -> android -> Is Library), while App references AppCore (properties -> android -> libraries -> Add; it shows in the Libraries tab of the Build Path dialog).

AppCore compiles without problem, but App does not. It says:

"The project cannot be built until build path errors are resolved"

However, the Build Path dialog does not show any error.

It happens both with the new project I have created and with the old projects I had in the workspace (no need to mention that they worked before the upgrade).

I've open the .classpath file and shows:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    <classpathentry kind="output" path="bin/classes"/>
</classpath>

After a lot of trial-error, I have removed the LIBRARIES line, and it no longer complains about the "build path errors", but of course it them claims about "missing classes" that are used from App to AppCore. But it tells me that the problem is related to that.

Any further idea? Any hint?

Upvotes: 1

Views: 8146

Answers (3)

dynamiclynk
dynamiclynk

Reputation: 2331

I fixed it by doing the following: (this was done using the ADT version of Eclipse, but should be applicable)

  • Project Properties > Java Build Path > Libraries (tab)
    • Remove each Library
    • Then click Add Library
    • Select the Android Classpath Container
    • Click Next or Finish

Upvotes: 0

Sabari
Sabari

Reputation: 51

The Build Path errors will come if the app contains the .jar file more than one time time...Ensure this will not happen at your side..and one more possibility is of the option we selected for the importing...Remove the AppcoreLib from App and then re-add...then clean the project..Hope this will help...

Upvotes: 0

Javier Sedano
Javier Sedano

Reputation: 953

Partial fix found!

The problem is that App is lexicographically before AppCore. So, when the workspace is cleaned, a rebuild is done... App is compiled, but the .jar file of AppCore is not available, so it fails. Then, AppCore is built, but App is not retried. Whenever I manually retry a clean-build cycle, the problem raises again.

But if I do not clean-build, but just build, it is compiled.

I'm still trying to figure how to force the clean-build in a particular order. preferences -> general -> workspace -> build order seems to define that... but it still seems to be ignored.

Any further idea?

Upvotes: 2

Related Questions