Question

I've seen that there are quite a few questions regarding this problem, but unfortunately none have solved it for me. Here is a screencap of what's going on:

pom.xml dependency error

It is dependent on the android-support-v4 jar file which as you can see is added to my build path. It the exact jar file from the maven library directory's libs folder. I've tried the following:

  • Restarting Eclipse
  • Cleaning the project
  • Right-clicking the project and updating dependencies
  • Updating project configuration Disabling and re-enabling workspace resolution

Nothing has helped. Is there any other tricks to getting this resolved? All of the answer's I've seen suggest doing these things that I have already tried.

Thanks a lot!

Was it helpful?

Solution

Actual root cause:

The OP JMRboosties reports in this instance having to desactivate Proguard (the tool which shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names)

disabling proguard on the line where the error occurred (the <plugin> item) in pom.xml solved the problem

(See "How to use ProGuard with android-maven-plugin ").

Certain side-effects can result from using Proguard: For example, the Proguard page does mention:

The default proguard.cfg file tries to cover general cases, but you might encounter exceptions such as ClassNotFoundException, which happens when ProGuard strips away an entire class that your application calls.


Original answer:

As mentioned in this GitHub post:

I'm going to deploy my own android artifacts to my personal repository to avoid having this problem again.
If you're not explicitly using Maven you can just import it as a regular Android project into eclipse and it'll pick up the .jar from the libs/ directory.

(Note your android-support-v4.jar isn't in libs in your project)

You have to install both Android 1.6 and the compat lib using the maven SDK deployer for now.

cd to platforms/platform-4/ and extras/compatibility-v4/ in the deployer and run mvn install in each.

Hopefully the compat lib makes it into maven central soon so I can avoid this step.

Again, the project is set up to be used as a normal Android project in eclipse too completely separate from maven.
File, New, Project, Android, use existing sources, select library/ folder.

OTHER TIPS

Assuming you're using m2e-android behind the scenes, the reason you're getting compile problems is that the m2e-android plug-in strips out all provided scope dependencies from the Eclipse project classpath.

We do this because, due to changes in ADT 16.0.0, any JAR file in the Eclipse classpath will be packaged into distributable APK file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top