0

I am creating a jar file where i did right click on project name then export>java>Jar file and then i checked on export generated class files and resources by selecting only src folder files and classpath and .project file.

This jar file i tried to use in another android project and i am getting this above

Unable to execute dex: Multiple dex files define com/example/projectname/xyzClass

So i followed this link here and unchecked my jar in order and export of buildpath and if i do so i am getting another error java.lang.NoClassDefFoundError: com.example.xyzClass

I have no idea why i am getting `Unable to execute dex: Multiple dex files define' error.

And here is the screenshot of order and export of my project where i am using my servicedemonew2.jar file.enter image description here

I would be glad if someone assist me with this why and when do we get this above error.

Community
  • 1
  • 1
Naveen Kumar
  • 979
  • 1
  • 13
  • 24

1 Answers1

0

After seen your screenshot you need to uncheck your Android Dependencies and servicedemonew2.jar checkbox. Android Private Libraries will be remain checkable.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
Piyush
  • 18,895
  • 5
  • 32
  • 63
  • No need to `

    Solution:

    ` as an answer should contain a possible solution which would make it redundant. A good programmer prevents redundancy!
    – WarrenFaith Nov 26 '14 at 12:26
  • Piyush still i haven't found a solution. If i uncheck those two then i am getting NoClassDefFoundError exception. – Naveen Kumar Nov 26 '14 at 12:30
  • Is Android Private Libraries checked?? – Piyush Nov 26 '14 at 12:30
  • Yes it is checked as you said. – Naveen Kumar Nov 26 '14 at 12:31
  • Strange before some day i got same issue and solved this way. Do one thing just uncheck Android Dependencies and other both will checkable. And finally clean your project and run it – Piyush Nov 26 '14 at 12:33
  • I tried adding the servicedemonew2.jar in libs folder also and checked private libraries and servicedemonew2.jar in order and export and tried and i am getting Unable to exec: Multiple dex file error. And if i delete jar from libs folder and try same then i get NoClassDefFoundError exception. – Naveen Kumar Nov 26 '14 at 12:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65690/discussion-between-piyush-gupta-and-naveen-kumar). – Piyush Nov 26 '14 at 12:44