Raghavendra Ragha
Raghavendra Ragha

Reputation: 73

How to download libraries in Android Studio?

Whenever I have to add certain library from the internet to my Android project, I add them inside the dependencies in the app level gradle script and it downloads the library for me. Is it possible to download these library files so that I can use them in other projects as well without downloading the whole library and dependency files again?

Upvotes: 0

Views: 8600

Answers (4)

oddmeter
oddmeter

Reputation: 774

I'd just run into an issue where a coworker's AS instance wasn't syncing with the server. In that case, we simply had to manually invoke the "Sync Project with Gradle File". For whatever reason, his AS instance wasn't doing that automatically.

Upvotes: 0

Brijesh Chopda
Brijesh Chopda

Reputation: 195

Find the gradle dependency for your library and put it in dependencies of your build.gradle file. For Example,

    dependencies {
        // other dependencies
        compile 'com.google.code.gson:gson:2.6.2'
    }

and then build the gradle file.

Upvotes: 0

OneCricketeer
OneCricketeer

Reputation: 191728

Just go to Maven central and download the libraries.

For example, here is Volley. Just click the download JAR button.

I would strongly recommend sticking with Gradle / Maven, though, to keep consistency with versions and appropriately handle additional dependencies for the libraries you want to download. They are called package managers for a reason, and they do their job well.

The libraries are actually downloaded to disk only once and shared between projects, they aren't downloaded for every new project.

Upvotes: 1

Malwinder Singh
Malwinder Singh

Reputation: 7060

Put library's jar file inside libs folder. Add this line in module level build.gradle (if not present):

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
     // Other libraries
}

Upvotes: 0

Related Questions