Package and reference aar and androidstudioaar in AndroidStudio
We have encapsulated some common class libraries and custom View Controls for half a day. To achieve better reuse, the most convenient way is to package the class library files.
However, I have to talk about it. It is troublesome to package something for Android encapsulation. This is really incomparable with. net. This is why I don't want to get Android.
Well, after vs2015 was officially launched, when vs supports android development, What eclipse, android studio, and so on will have to die.
Open-source and free things are not easy to use.
Okay, it's over.
Currently, I am using android studio. After all, Google has clearly stated that eclipse is no longer supported.
When exporting the class library, there are two options: aar and jar. The difference is that aar contains a series of resource files for Android, including layout, drawable, and so on. Jar only contains code.
So decide which one to use as needed.
It is easy to change, as shown below:
Modify the property file, change the original plugin application to library, and comment out the applicationID.
That is to say, as a class library, the class library certainly has no attributes such as applicationID.
After you click build-> makeproject, the aar file is automatically generated.
Under the arr folder
Then, let's talk about how to import data to other projects.
Right-click the project root node and choose new-> module. The menu chart is not captured here...
Select
Select the aar File
Then let Gradle run for a while
In this way, the operation is successful.
Then I want to adjust the build path.
Load the referenced module
Finally, remember to package it into the lib class library project, AndroidManifest. do not add any settings to the xml file. You must delete or comment out the application configuration section. Otherwise, conflicts may occur during compilation.
You can use it directly.
Finally, I spoke about the android IDE environment again. I really hope that VS2015 will be supported. Of course, it is best to provide native Android support instead of making an HTML framework. But how is it better than the existing ide.
Is it still possible to look forward to. net open source? Maybe C # can be used to directly develop Android applications...
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.