T
T
turbolizard2016-02-16 14:52:38
Android
turbolizard, 2016-02-16 14:52:38

How does Gradle know about third party libraries?

The question is, in Android Development quite recently, I decided to understand what gradle is.
Now it is fashionable not to add jars with libs, but to take them directly in the Gradle links, but!
Where does Android Studio get them from in this case? Are they in the support library?
Or downloaded from the Internet? How can I place my libs so that they can also be linked in Gradle?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
georgeci, 2016-02-16
@georgeci

Libraries (artifacts) in the form of jar or aar files are stored in special repositories. In build.gradle, you can specify which repository to look for. By default, gradle looks for them in JCenter , but you can specify others.

buildscript {
    repositories {
        jcenter() // по умолчанию присутствует в файле
        mavenCentral() //указание на другой репозиторий
        maven { url 'https://maven.fabric.io/public' }     //указание на другой репозиторий
    }
}

You can use similar services for your libraries or even raise your own repository.

R
Roman Artemov, 2016-02-16
@roman_art

File your libs as android library and in gradle file:
compile project(':library_name')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question