Adding a 3rd party library to Android studio is not really a bother, it's just that there is no UI, so there's a need for some hands-on. Google is very optimistic about Android studio, so the UI should be supported soon. Before doing this, please add the library as follows.
Android Studio Core is IntelliJ, but in the encoding apk, he used Gradle. IntelliJ is a famous IDE, inside can refactor of things, it is worth to use to see, it has a UI can add library dependency. But the question is gradle,gradle. A somewhat similar build management system with MAVEN, Gradle's language is much more understood than Maven's XML and deserves to be studied. Now Android Studio has no UI to edit gradle, it's all about using pure text files, and it's not too difficult.
So, to add a new library from Maven repository, you need the following steps:
First come to http://search.maven.org/, use Search to find the library you want
Let's take Gson for example today.
Open the Build.gradle of the main case
For example, the top layer is exampleproject, this is container can contain each related sub-project, it has another Example this is the main project, Build.gradle is in the Example this record.
Add the following lines
Repositories{Mavencentral()}Dependencies{Compile‘Com.Android.Support:Support-V4:13.0.+‘CompileGroup:‘com. Google. Code. Gson ' name: gson ' version: ' 2.2.4 ' compile files ( ' libs/android-< span class= "n" >async-http-1.4.3 jar ' ) }
Among them compile group: ' Com.google.code.gson ', Name: ' Gson ', version: ' 2.2.4 ' is certainly the repository function from Maven Gson.
When Android Studio grabs the file, it will soon be discovered that there is a line in External libraries.
When these are done, you should be done.
Android Studio: Add a function library from maven