如何将 Material Design 库导入 Android Studio? [英] How do I import material design library to Android Studio?

查看:93
本文介绍了如何将 Material Design 库导入 Android Studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将此库导入到我在 Android Studio v1.0.0 rc2 中的项目中:

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:

错误:Dependency MyApplication.libraries:MaterialDesign:unspecified on project app 解析为不支持作为编译依赖项的 APK 存档.文件:C:\ADTBundle\StudioWorkspace\MyApplication\libraries\MaterialDesign\build\outputs\apk\MaterialDesign-release-unsigned.apk

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

解决此问题的分步指南是什么?或者这个库的 gradle 依赖是什么?

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

推荐答案

如果您使用的是 Android Studio:

If you are using Android Studio:

  • 您可以将项目作为模块导入,并在导入模块的 build.gradle 文件中更改以下内容.

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

更改应用插件:com.android.application 以应用插件:com.android.library删除 applicationId 并设置 minSdkVersion 以匹配您的项目 minSdkVersion.

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

并且在您的项目 build.gradle 文件中 compile project(':MaterialDesignLibrary'),其中 MaterialDesignLibrary 是您的库项目,或者您可以通过 File -> Project Structure -> 在 Modules 下选择您的项目 -> Dependencies -> 点击 + 添加模块.

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.

这篇关于如何将 Material Design 库导入 Android Studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆