[Android Studio] *. jar and *. aar generation and *. aar import project method, android. aar
This section describes how to generate an aar file in Android Studio and use the aar file locally. *. Jar and *. aar files are generated at the same time when you generate a self-built library in Android Studio. Storage locations:
*. Jar: Library/build/intermediates/bundles/debug (release)/classes. jar
*. Aar: Library/build/outputs/aar/libraryname. aar
Differences:
*. Jar: contains only class files and list files, excluding resource files, files, and other res files.
*. Aar: contains all resources, and all class and res resource files.
If you are just a simple class library, use the generated *. jar file. If you use a UI library that contains some control layout files and font and other resource files written by yourself, you can only use *. aar file.
Usage:
*. Jar: copy the file to the: libs directory. You can directly import the file to eclipse. Add the following to the AndroidStudio project:
?
123 |
Dependencies {compile fileTree (include: ['*. jar'], dir: 'libs ')} |
Re-compile a project to complete the loading.
*. Aar: There are two methods: Local Loading and network loading. Since network loading involves publishing to mavenCentral hosting, we will not discuss it here. In addition, we will not discuss it if eclipse has not been used for a long time; this is a simple and fast local loading method.
The aar file demonstrated here is: "genius. aar"
Step 1: Copy to: libs directory
Step 2: change
?
12345678 |
Repositories {flatDir {dirs 'libs'} dependencies {compile (name: 'genius ', ext: 'aar ')} |
Added "repositories" and changed "dependencies" respectively, and re-compiled the project to work properly.
Open the "\ build \ intermediates \ exploded-aar \ hosts" file.
This is what Android Studio automatically parses the aar file.
How to reference the aar package in Android studio
Android studio currently does not support referencing local aar. View
Code.google.com/..20.55863
How to generate an aar package
-_-!!! Jar ...... What IDE do you use? IDE can directly compress the project into a jar package. If only JDK and notepad are used, then run the jar command on the command line, just like javac.
· Javac-compiler, which converts the source program into bytecode
· Jar-packaging tool to package related class files into one file
· Javadoc-document builder, which extracts documents from source code comments
· Jdb-debugger, error checking tool
· Java-run the compiled java program (. class suffix)
Appletviewer: applet browser, a Java browser that executes Java applets on HTML files.
Javah: generate the C process that can call the Java Process, or create the header file of the C process that can be called by the Java program.
Javap: Java anti-assembler that displays the accessible functions and data in the compilation class file and the meaning of the byte code.
Jconsole: a Java tool for system debugging and monitoring
Reference: Part of this document is taken from encyclopedia