Dex Error When I Include .jar Files Into My Android Project
Solution 1:
If you read this document, you will get to know that Android app (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536 or 64k methods. The jar files you are using contains Classes and methods. Adding them to your projects must be surpassing the maximum allowed 64k methods mark and thus it generates the error.
This problem is a common one and has a lot of solutions available, for eg this. However, in your case I would recommend you to do go to your app level gradle file and remove all unnecessary dependencies and redundant dependencies(if present). Also try to import only those dependencies which are actually needed by the project, for eg, if you require libraries from Google play services, instead of importing the entire google play services library, import only those which are actually needed by your project.
Also if possible, try to find jar files which which can replace your current jar files.
PS: Can you let me know the names of the jar files you are trying to import. It may help in resolving the issue in an easy way.
Post a Comment for "Dex Error When I Include .jar Files Into My Android Project"