[英]AndroidStudio - Module Dependencies in Gradle
I have a little problem compiling an android application using module dependencies in Android Studio.我在使用 Android Studio 中的模块依赖项编译 android 应用程序时遇到了一个小问题。
So, I want my application to use the library 'slidingmenu' (link here ).所以,我希望我的应用程序使用库“slidingmenu”(链接在这里)。
Here is my application tree:这是我的应用程序树:
Here is a link to see what I mean.这是一个链接,可以了解我的意思。
This is the error I'm getting.这是我得到的错误。
Gradle: A problem occurred configuring project ':Application'. Gradle:配置项目“:应用程序”时出现问题。
Failed to notify project evaluation listener.未能通知项目评估侦听器。
Configuration with name 'default' not found.未找到名为“default”的配置。
How do I specify a module dependency and where do I put the modules (inside Application or inside ApplicationProject?如何指定模块依赖项以及将模块放在哪里(在 Application 内还是在 ApplicationProject 内?
Thanks!谢谢!
EDIT 1: Never mind!编辑1:没关系! I got back to eclipse!我回到了日食! Android Studio is just not ready for a true project development. Android Studio 还没有为真正的项目开发做好准备。
You should put your library modules inside the Application Project.您应该将您的库模块放在应用程序项目中。 In order to specify a module dependency, simply:要指定模块依赖项,只需:
Then, this module will show up in your project.然后,此模块将显示在您的项目中。 Then, you need to add it to Application as a library dependency.然后,您需要将其作为库依赖项添加到Application中。 Once again, in your Module Settings :再次,在您的模块设置中:
For people using the gradle way (explicitly rather than being generated by the IDE):对于使用 gradle 方式的人(明确而不是由 IDE 生成):
Add this to your app's build.gradle
:将此添加到您的应用的build.gradle
:
dependencies {
....
// other dependencies...
implementation project(':module-name')
}
Add module as dependency添加模块作为依赖
settings.gradle
将模块添加到settings.gradle
include ':MyModule'
//Additionally you can specify directory here
project(':MyModule').projectDir = new File('SomePath/HelloWorld')
dependencies {
implementation project(':MyModule')
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.