How to insert a library into a project in Android Studio?

Asked

Viewed 3,030 times

3

I’m new to developing applications for Android and I found it really cool the idea of incrementing my applications with a kind of Intro as soon as they run.

It was searching about it that I came to this library: https://github.com/PaoloRotolo/AppIntro

It turns out, however, that I’m not getting to add it to the project. I’ve tried to declare this library as a dependency on my build.Radle, just as the developer explains, but I couldn’t get the library to be downloaded into my project on Android Studio.

Can anyone assist me by doing a step by step or have a more suitable suggestion to accomplish what I’m asking?

Thank you =)

1 answer

1


First, perform your Android Studio with permissions of administrador.

After that, navigate to the build.gradle at the root of your project and add the line:

buildscript {
    repositories {
        mavenCentral()
    }
}

Soon after changing this file, a similar message will appear at the top of your Android Studio:

inserir a descrição da imagem aqui

Click on Sync Now.

Then go to the build.gradle within your project directory (usually called app) and add the line:

dependencies {
    compile 'com.github.paolorotolo:appintro:2.0.0'
}

After the change, the above message will appear again and once again click on Sync Now.

This way you will be able to use the library within your project.

Another way to do the Sync of your files .gradle is through the shortcut:

inserir a descrição da imagem aqui

  • First of all, thank you for the explanations, @sicachester. I performed the procedures you indicated but it turns out that in the first change you suggested did not appear the message at the top of Android Studio. I tried to synchronize the project using the image shortcut you posted but this also did not cause any effect. One thing that should be mentioned is that I created a project from scratch to test the changes you suggested. Do I need to configure something from Maven in my environment?

  • 1

    I ran Android Studio with administrative permissions and after that the message indicating Sync appeared. Now, every time I change something in the files . Gradle I perform sync, just like you told me. But answer me one thing: shouldn’t this sync download the files to my project? The file structure seems not to have changed even after performing Sync several times. The library files I mentioned should appear in Project or is this a trip of mine?

  • @Spammingoff after you add dependency within your build.gradle and carry out the Sync, it will download in the last package called External Libraries. Inside will appear the dependency along with the others already imported from your project (such as the Android SDK etc)

  • 1

    Oh dear... True. Now I need to learn how to use this library =) Thank you so much for your help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.