如何将材料设计库导入到Android Studio? [英] How do I import material design library to Android Studio?

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

问题描述

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



https://github.com/navasmdc/MaterialDesignLibrary



但是有一个问题。当我将这个库作为模块添加时,出现这个错误:


错误:依赖项MyApplication.libraries:MaterialDesign:项目应用程序未指定解析为不支持作为编译依赖项的APK归档文件。文件:C:\ ADTBundle \StudioWorkspace\MyApplication\libraries\MaterialDesign\build\outputs\apk\MaterialDesign- release-unsigned.apk

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

解决方案

如果您使用的是Android Studio:




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

  • c $ c> com.android.library
    删除 applicationId 并设置 minSdkVersion 以匹配您的项目minSdkVersion。


  • 并且在您的项目中 build.gradle 文件 compile project(':MaterialDesignLibrary'),其中 MaterialDesignLibrary 是您的库项目的名称,或者您可以通过文件 - 项目结构 - >在模块 - >依赖关系 - >点击+添加模块下选择您的项目。



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?

解决方案

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.

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

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