1. Put the jar package into the Lib folder in module. (Create Lib folder yourself)
2. In project, select the Jar package and right click "Add as Library".
3, at this time the project is still unable to compile properly, then need in the project module of the Build.gradle file in the Dependencies section to add the following content
The address inside the files brackets here is relative to the Build.gradle file.
4, this time the project compiles and runs normally, but when you actually create a reference jar in your code of the class instance, it is possible that the system will throw an exception noclassdeffounderror, this time can follow the following steps:
? Go to the Command Prompt window.
? Navigate to the root of the project, which is the directory where build.gradle resides.
? Run "{Android Studio installation directory}\sdk\tools\templates\gradle\wrapper\gradlew.bat" clean
? Recompile a running project
By doing this, you should be able to resolve the issue.
Android Studio Import External lib file