Search code examples
androidandroid-studiomavendependenciesrepository

How to implement external library in Android Studio from file


I need to implement com.mindorks:paracamera:0.2.2 in my project, its no longer available through repositories and can not be downloaded.

if I use

 dependencies {
implementation 'com.mindorks:paracamera:0.2.2'

I get the following error:

Could not find com.mindorks:paracamera:0.2.2.

I have the files

paracamera-0.2.2.aar

paracamera-0.2.2-javadoc.jar

paracamera-0.2.2-sources.jar

paracamera-0.2.2.pom

which I got from second computer that has the library in C:\Users\xxx.gradle\caches\modules-2\files-2.1\com.mindorks\paracamera\0.2.2\

How can I implement all files, so far I tried to copy all in libs folder and "add as library"

thanks all for helping


Solution

  • Firstly, copy paracamera-0.2.2.aar, paracamera-0.2.2-javadoc.jar and paracamera-0.2.2-sources.jar to the directory /your_project_name/app/libs/. Then add the following code in /your_project_name/app/build.gradle to add dependencies. Finally sync project with gradle.

    android {
        repositories {
            flatDir {
                dirs 'libs'
            }
        }
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation(name: 'paracamera-0.2.2', ext: 'aar')
    }