how Android studio generates AAR packagesTags: how Android studio generates aaandroid studio aarandroid How to build an AAR package2016-12-21 14:42 1856 people read comments (0) favorite reports Classification:Android Development ($)
When you build on one of your own libraries in Android studio, both the. jar and the. aar file are generated.
Store location separately:
*.jar: library/build/intermediates/bundles/debug (release)/classes.jar
*.aar: library/build/outputs/aar/libraryname.aar
The difference between the two:
*.jar: Contains only the class file and the manifest file, does not contain the resource file, the slice and so on all res files.
*.aar: Contains all resources, class, and res resource files all contain
If you are just a simple class library then use the generated. jar file, and if you are a UI library that contains some resource files such as your own control layout files and fonts, you can only use the. aar file.
How to use:
*.jar: Copy to: Libs directory, Eclipse import directly, add in Androidstudio project:
1.aar package is an AAR file generated by SRC, Res, and Lib in Android studio under the packaging of Android, and after the AAR package is imported into other Android studio projects, other projects can be easily referenced by source code and resource files.
2. To generate the AAR package step:
①. Open a project with Android studio, then create a new module, select the Android Library when you create the module, and follow the new normal project operation
②. After the new module type is Android Library as shown
③. After the code is written in the new module, the AAR package is automatically generated after the entire project is compiled, and the path of the package is in the new module = = "Build = = =" Outputs ==>aar directory.
3. Other Androidstudio Projects Reference AAR package
①. Copying the AAR package to the Lib directory
②. Configuring the Build.gradle file:
Join
repositories {
Flatdir {
Dirs ' Libs '
}
Compile (name: ' camerascan-1.0 ', ext: ' AAR ')
Complete configuration file:
[Java]View Plain Copy
- Apply plugin: ' com.android.application '
- Android {
- Compilesdkversion
- Buildtoolsversion "22.0.1"
- Defaultconfig {
- ApplicationID "Com.geenk.testcamerascanarr"
- Minsdkversion
- Targetsdkversion
- Versioncode 1
- Versionname "1.0"
- }
- Buildtypes {
- Release {
- Minifyenabled false
- Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '
- }
- }
- repositories {
- Flatdir {
- dirs ' Libs '
- }
- }
- }
- dependencies {
- Compile Filetree (dir: ' Libs ', include: [' *.jar '])
- Compile (name:' camerascan-1.0 ', ext:' aar ')
- Compile ' com.android.support:appcompat-v7:22.2.0 '
- }
③. Compiling a project
Copy AAR package to Lib
After the diagram is copied to LIB, click the button to make the AAR package available for reference in the code, or to compile the project once
After successful operation, you can see the referenced AAR package file under the expansion package.
-
Top
-
1
-
Step
-
0
- Previous custom material design style ProgressDialog
- Next Android JNI package so file to apk
Related articles recommended
- ? Android Studio Imports local AAR and jar packages
- ? "Live" machine learning & Data Mining 7 weeks training--Wei Chi
- ? Android Studio generates AAR packages and references (imports) AAR packages in other projects
- ? "Live" large and medium-sized UGC information site SEO Sharing--Choshangyang
- ? *.aar Package in Android Studio
- ? "Live" to get through Linux context processes, threads, and schedules-Song Baohua
- ? Axis2 code generation and hit AAR package eclipse plugin
- ? "Package" Java Advanced Programmer Professional Learning route-Xiaohaipeng
- ? Generate a jar package for a module in Android studio, and think it's okay to use AAR directly
- ? "Course" basic of C + + language------Li Jian
- ? Android Studio Build AAR package, jar package
- ? "Curriculum" deep learning Foundation and TensorFlow practice--ai100
- ? How Android studio relies on AAR project packages
- ? Android-support-percent.aar
- ? Android Studio 2.3 Dozen AAR packs
- ? Android Studio and Eclipse generate jar packages separately and confuse Jar package demo
View Comments
No Comments
You are not logged in, please [login] or [register]* above the user's comments on behalf of their personal views, does not represent the views or position of the CSDN website
(reprint) How Android studio generates AAR packages