If your project needs to reference a third-party jar file, you need to make some changes to the build command.
First create the Libs directory in the project root directory and copy the required jar files inside.
There are two steps to be changed during the compilation process.
When compiling a Java source file, you need to add class path, which is the path to the-CP jar file, and if more than one jar needs to be used, separate multiple paths with semicolons, for example:
Javac-encoding utf-81.61.6 -bootclasspath \android\sdk\platforms\android- Android.jar-CP \android\sdk\extras\android\m2repository\com\android\support\support-v4\19.1. 0\support-v4-19.1. 0. jar-d bin\classes Src\test\android\mini.java Gen\test\android\r.java
When you package the DEX format, add the jar file, and if you have more than one jar, add a space, followed by:
D:\Android\sdk\build-tools\19.1. 0\dx.bat--dex--output=bin\classes.dex bin\classes \android\sdk\extras\android\m2repository\com\android\ support\support-v4\19.1. 0\support-v4-19.1. 0. jar
This adds the dependent jar file to the APK.
The simplest Android project (add jar file)