4

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.

Community
  • 1
  • 1
Death Programmer
  • 896
  • 2
  • 11
  • 28

4 Answers4

6

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.

Calvin
  • 468
  • 3
  • 7
5

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.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
0

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.

msysmilu
  • 2,015
  • 23
  • 24
  • 1
    If you need first to remove an already included module: http://stackoverflow.com/questions/16710290/how-to-delete-a-module-in-android-studio/27404458#27404458 – msysmilu Feb 10 '15 at 15:39
0

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'
}
Dhaval Jivani
  • 9,467
  • 2
  • 48
  • 42