Reputation: 25
I want to know that which is the best way to use external libraries in android studio and workflow of it. Either to compile them directly in build.gradle and using its functionalities or copy the whole external library in my project.
Some doubts:- If i am using first way then how it works, is it connected to internet or i can have problems in future if that library is deleted from github or somewhere else
And if i am using second way then it is true that it will increase the size of my apk but it will not cause any problem in future because it is secured in my project and there is no chance of losing it as in the first way it can be deleted. Please correct my doubts because i am not sure what is happening there?
Upvotes: 1
Views: 544
Reputation: 7415
I want to know that which is the best way to use external libraries in android studio
Both of them has a pros and cons:
Using the Build.gradle approach:
Pros:
Easy to add since its just adding a single line of code in your Gradle.
Easy to update (Just change the version number and click sync gradle).
Cons:
Using the Library/Module itself:
Pros:
Cons:
And if I am using second way then it is true that it will increase the size of my apk
Adding Librarie(s) to your project will surely increase the APK, it is inevitable.
Upvotes: 1
Reputation: 1020
The best way to use an external library in your project is the first one. Just add the dependency in build.gradle. There is no insecurity in adding it like this. You will have to be connected to the Internet for the first time you build your project. It will download and include the jar in your project. After this even the dependency is deleted from git, your project will work well.
Upvotes: 1