Death Programmer
Death Programmer

Reputation: 896

Can't import Material Design Library in android studio

I read this page, that learn "importing libraries into android studio". but it's doesn't work for me. i do those step for Material Design Library. in Material Design's build.gradle file have:

https://github.com/navasmdc/MaterialDesignLibrary/blob/master/MaterialDesign/build.gradle

when i click on "Sync Project with Gradle Files" it's gives me two error:

  1. Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
  2. Error:(3, 0) Plugin with id 'com.jfrog.bintray' not found.

Can any one tell me how to solve those error's?

note: i read this, but don't understand.

Upvotes: 4

Views: 9539

Answers (4)

Dhaval Jivani
Dhaval Jivani

Reputation: 9697

Add two dependencies in your Project build.gradle

dependencies {
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}

Upvotes: 0

Calvin
Calvin

Reputation: 443

If you want to download the Material Design Library and import it without using the gradle method pyus13 mentioned, you need to add the following lines to the MaterialDesign Build.gradle file:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
    }
}

To find this file, you can double click on the error you get when syncing that looks like this:

Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.

I also had to add compile project(':MaterialDesign') to the app build.gradle file.

Upvotes: 6

msysmilu
msysmilu

Reputation: 2024

This was kindly answered @pyus13 but I would like to give the complete answer, with the source, github.com/navasmdc/MaterialDesignLibrary#howtouse:

You can use the gradle dependency, you have to add these lines in your build.gradle file:

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
}

The build.gradle you are looking for is in ProjectName\app\src.

Upvotes: 0

Piyush Agarwal
Piyush Agarwal

Reputation: 25858

Dont follow the above tutorial, the shown approach is useful when the library has not published as maven or gradle dependency.But as Github page say it is published on maven.

So remove the module or library project completely from your project and use gradle dependency instead.

Just copy this in your app module's build.gradle inside dependencies closure

dependencies {
     // YOUR OTHER DEPENDENCIES
     compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
}

Sync your project with gradle.

Upvotes: 5

Related Questions