This question has already been answered:

Hello, I want to connect this library in Android Studio , but I do not understand how to connect it and use it in code?
I have already tried through File-> Project Structure-> Dependencies , but I didn’t figure it out.

Reported as a duplicate by members pavlofff , VenZell , aleksandr barakin , D-side , user194374 Mar 29 '16 at 6:07 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

2 answers 2

  1. In your project, create a package com.pascalwelsch.holocircularprogressbar

  2. In this package, create a java-class HoloCircularProgressBar.java .

  3. From the library folder, copy the contents of the HoloCircularProgressBar.java file and paste into your file. See that the package was specified only 1 time. Will swear that "cannot resolve symbol r". You need to import this very r ( Alt+Enter into Android Studio) and rebuild project

  4. From the res folder of the project on the github we copy attrs.xml (creating it if not) and styles.xml (adding its contents to its own corresponding file)

  5. We look at an example of using the desired widget in CircularProgressBarSample ( sample/src/com... folder sample/src/com... )

It would be possible to create the main file in its main package, but then it will have to be addressed differently (not as in the use case)

  • 2
    In my opinion, this is a very unfortunate way to connect libraries to a project. And what if there is more than 1 file? And what if the library is updated? The correct connection method in this case will be connecting the library as a module. - temq
  • So explain to the person how to do it. I will also learn with joy. - iramm
  • See the comment under the questions about the duplicate - temq
  • @temq This is my comment. On your tip, I found this link. Thank you) - iramm
  • I meant the comment @pavlofff - temq

You upload the .jar library files to the project directory in the app/libs folder, then go to File->Project Structure->Dependencies plus the file dependency File->Project Structure->Dependencies and add the .jar library file

  • This is the problem that everyone is talking about .jar files and I have a library project. - Max Oguenko