Alexander Hryk
Alexander Hryk

Reputation: 585

I can not add a dependency in Android Studio

I'm new in Android Studio and i want to add dependency to custom view (https://github.com/glomadrian/dashed-circular-progress) in my project. I downloaded *.arr file from Maven repository and imported it like a AAR module. But i can't compile my project because there are some exceptions with this custom view: ClassNotFoundException. Could someone explain me step by step how to correctly add dependencies from maven rep? or there are some problems with this DashedCircularProgress.aar? Thanks.

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.ahryk94gmail.mibandsdk"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven {
        url "http://dl.bintray.com/glomadrian/maven"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile files('libs/gson-2.6.2.jar')
    compile 'com.github.glomadrian:DashedCircularProgress:1.0@aar'
}

Upvotes: 1

Views: 1363

Answers (1)

Michael
Michael

Reputation: 54705

As mentioned in the project description you have to add the following code to build.gradle:

repositories {
  maven {
    url "http://dl.bintray.com/glomadrian/maven"
  }
}

dependencies {
    compile 'com.github.glomadrian:DashedCircularProgress:1.0@aar'
}

UPDATE:

Also you can use jitpack.io and download the dependency right from GitHub.

repositories {
  maven {
    url "https://jitpack.io"
  }
}

dependencies {
  compile 'com.github.glomadrian:dashed-circular-progress:59d245a'
}

Upvotes: 2

Related Questions