Home » Android » gradle – How do I import material design library to Android Studio?

gradle – How do I import material design library to Android Studio?

Posted by: admin April 23, 2020 Leave a comment

Questions:

I want to import this library to my project in Android Studio v1.0.0 rc2:

https://github.com/navasmdc/MaterialDesignLibrary

But there is a problem. When I add this library as a module, this error appears:

Error:Dependency MyApplication.libraries:MaterialDesign:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: C:\ADTBundle\StudioWorkspace\MyApplication\libraries\MaterialDesign\build\outputs\apk\MaterialDesign-release-unsigned.apk

What would be a step-by-step guide to solve this problem? Or what would be a gradle dependency for this library?

How to&Answers:

If you are using Android Studio:

  • You can import the project as a module and change the following in the build.gradle file of the imported module.

  • Change apply plugin: com.android.application to apply plugin: com.android.library
    remove applicationId and set minSdkVersion to match your project minSdkVersion.

  • And in your project build.gradle file compile project(':MaterialDesignLibrary'), where MaterialDesignLibrary is the name of your library project or you can import the module by File -> Project Structure -> Select your project under Modules -> Dependencies -> Click on + to add a module.

Answer:

There is a new official design library,
just add this to your build.gradle: for details visit android developers page

compile 'com.android.support:design:27.0.0'

Answer:

Add the design support library version as same as of your appcompat-v7 library

You can get the latest library from android developer documentation
https://developer.android.com/topic/libraries/support-library/packages#design

when i answering this is the latest library

implementation 'com.android.support:design:28.0.0'

Update
Android X : https://material.io/develop/android/docs/getting-started/ follow the instruction in here
latest dependency is

implementation 'com.google.android.material:material:1.1.0'

Answer:

Goto

  1. File (Top Left Corner)
  2. Project Structure
  3. Under Module. Find the Dependence tab
  4. press plus button (+) at top right.
  5. You will find all the dependencies

Answer:

The latest as of release of API 23 is

compile 'com.android.support:design:23.2.1'

Answer:

If you migrated to AndroidX you should add the dependency in graddle like this:

com.google.android.material:material:1.0.0-rc01