Skip to content
This repository

Not copying compiled classes to build directory for ADT 17 #72

Closed
rgladwell opened this Issue · 14 comments

4 participants

Ricardo Gladwell Mykola Nikishov tziem Michael Schöndorfer
Ricardo Gladwell
Owner

ADT 17 is not properly copying compiled classes to the build directory.

Ricardo Gladwell
Owner

According to this article:

http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

It looks as though dependencies that need to be included in the ADT APK dex classfiles must be marked as "exported in the referencing project."

Ricardo Gladwell
Owner

I can confirm, the problem is that the Maven classpath container is not marked as exported. I'm working on a code fix for this, but in the meantime this is the work around to get it working:

  1. Right-click on your project and select "Properties".
  2. Click on "Java Build Path".
  3. Click on the Order and Export tab.
  4. Check the check box for "Maven Dependencies".
  5. Click OK
  6. Select Project -> Clean

This should now work. Running Maven -> Update Project Configuration... will wipe these settings.

Ricardo Gladwell rgladwell referenced this issue from a commit
Ricardo Gladwell [task #72] Fix: as of ADT 17 classpath containers to be included in APK
binaries must be marked as exported.
7fee336
Ricardo Gladwell
Owner

This has been fixed. Could someone please test and verify this is resolved, fix should hit the master/snapshot update site within the next hour:

http://rgladwell.github.com/m2e-android/updates/master

Ricardo Gladwell rgladwell closed this
Mykola Nikishov

In my case, Maven -> Update Project Configuration... failed (m2e 1.1.0.20120320-0058).

I have an Ant project with .classpath/.project files and libs/ folder with required depednencies. Update Project Configuration... will NOT remove neither libs/ folder nor references in .classpath file from the project's classpath.

These would fix:

  • remove libs/ folder from filesystem;
  • remove references to these JARs from .classpath
Ricardo Gladwell
Owner

@manandbytes I'm not sure m2e-android supports use of the libs/ folder. Is this causing some kind of conflict? Do you have duplicate classes in both your libs/* folder and Maven dependencies?

On twitter you mentioned that the problem was caused by the absence of JRE lib container in your classpath? (see issue #7)

Could you post a gist with the error/stacktrace you're seeing, please?

Mykola Nikishov

I'm not sure m2e-android supports use of the libs/ folder

I'm sure it doesn't.

Is this causing some kind of conflict? Do you have duplicate classes in both your libs/* folder and Maven dependencies?

Exactly. This project moves from legacy Ant build to Maven and still has .classpath, .project and libs/ folder with dependencies. At the same time, it has a POM that duplicates the same dependencies from libs/ but as a Maven artifacts.

On twitter you mentioned that the problem was caused by the absence of JRE lib container in your classpath? (see issue #7)

No, this is not a problem.

Could you post a gist with the error/stacktrace you're seeing, please?

I tried to re-import my project using both ways:

  • as existing Eclipse project and later convert it to Maven project;
  • as existing Maven project directly.

In both cases there are no build errors, but project fails to dexify due to duplicated classes in classpath.

Ricardo Gladwell
Owner

Exactly. This project moves from legacy Ant build to Maven and still has .classpath, .project and libs/ folder with dependencies. At the same time, it has a POM that duplicates the same dependencies from libs/ but as a Maven artifacts.

@manandbytes If you have the same dependencies included twice, the APK Builder probably will error. Could you just use Maven to manage your dependencies?

tziem
tziem commented

I've successfully tested the fix.

Ricardo Gladwell
Owner

@tziem thanks for the feedback. glad its working for you.

Michael Schöndorfer

Works for me too

Ricardo Gladwell
Owner

@michael-customlbs thanks for the feedback, its reassuring to know this is working for people. I'll release a new version soon.

Michael Schöndorfer

Now I have the follow problem:

java.lang.IllegalArgumentException: already added: Lorg/slf4j/helpers/BasicMarker;

I added slf4j-api as a dependency in a library. This library is added in my Android App, but I exclude the slf4j-api because I add slf4j-android in the App. Although I exluded the API it is added to the "Android Dependencies" and I get the error message.
This has worked before.

Ricardo Gladwell
Owner

@michael-customlbs thanks for reporting this. sounds like a separate issue to this one, could you please raise a new ticket, preferably with a sample POM so I can reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.