3

I am trying to get an app to run on android studio and have just finished working through the gradle dependency issues for the build, but when running I am getting the above error. It says specifically:

"no main manifest attribute in PROJECT_PATH/app/libs/commons-codec-1.10.jar"

This is followed by the socket disconnecting and the process finishing with an exit code 1.

I have looked through the manifest as many other posters have suggested and looked for a call to a main file and it does not have one. This seems to be true of the majority of .jar library files that I have in the project.

As I do not have the ability to easily change the jar files without remaking them, I am unsure how I would go about adding this through Android Studio.

Has anyone else run into this issue or have any ideas on how to get past it?

EDIT: The jar file that is giving the issue is a .jar that is used as a library along with quite a few others.

KM529
  • 372
  • 4
  • 17

1 Answers1

0

Delete the jar, modify your build.gradle file instead:

dependencies {
    compile 'commons-codec:commons-codec:1.10'
}
Stephan Branczyk
  • 9,363
  • 2
  • 33
  • 49
  • When I have the jar in the project, the gradle build already has that line of code in there with the following: compile files('libs/commons-codec-1.10.jar'). Should i change that and delete it? – KM529 Feb 05 '16 at 02:04
  • Yes, you should. The current line references the local copy of the jar. The line I am suggesting will get the jar from the web. So you replace one with the other. Or if you want to rebuild it yourself, you could try this http://stackoverflow.com/questions/2591516/why-has-it-failed-to-load-main-class-manifest-attribute-from-a-jar-file?rq=1 – Stephan Branczyk Feb 05 '16 at 05:00