Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 918
Death Programmer Avatar asked Dec 15 '22 17:12

Death Programmer


2 Answers

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.

like image 147
Calvin Avatar answered Feb 12 '23 20:02

Calvin


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.

like image 35
Piyush Agarwal Avatar answered Feb 12 '23 20:02

Piyush Agarwal