[英]issue importing maven project - android studio
I am trying to import a project in Android Studio
and I am very new to this ide
. 我试图导入一个项目Android Studio
,我很新ide
。 So, I created some Libraries
folder, copied inside the file and then added one line (the last one) to to my build.gradle
: 因此,我创建了一些Libraries
文件夹,将其复制到文件中,然后在build.gradle
添加一行(最后一行):
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.android.support:support-v4:13.0.+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile ":libraries:library"
}
Edit : 编辑:
I added some settings.gradle
file with include ":libraries:library"
我添加了一些include ":libraries:library"
settings.gradle
文件
When I launch the gradle
build I get 当我启动gradle
构建时,我得到
A problem occurred configuring root project 'NewsFeeder'.
Total time: 6.507 secs
> Configuration with name 'default' not found.
Here's a screen of my tree. 这是我的树的屏幕。 Is the problem related to the pom.xml
file inside the IconicDroid-master
plugin 问题与IconicDroid-master
插件内的pom.xml
文件有关IconicDroid-master
The basic problem is that you need to have a settings.gradle file that tells Gradle where to find the library; 基本问题是,您需要有一个settings.gradle文件,该文件告诉Gradle在哪里可以找到该库。 it's not enough to put a path spec in your build.gradle file. 仅在build.gradle文件中放置路径规范是不够的 。 However, I would recommend refactoring your project into a multimodule structure: 但是,我建议将您的项目重构为多模块结构:
ProjectFolder +- NewsFeeder | +-src | +-res | +-build.gradle +- iconicDroid-master | +-src | +-build.gradle +-settings.gradle +-build.gradle
Your settings.gradle file will look like this: 您的settings.gradle文件将如下所示:
include ':NewsFeeder'
include ':iconicDroid-master'
You will need to set up a Gradle build file for your iconicDroid library; 您将需要为iconicDroid库设置一个Gradle构建文件; I wouldn't recommend trying to mix Gradle and Maven builders in the same project. 我不建议尝试在同一项目中混合Gradle和Maven建设者。
After you modify build.gradle or settings.gradle files, click the Sync Project with Gradle Files button in the toolbar to make the IDE pick up the changes. 修改build.gradle或settings.gradle文件后,单击工具栏中的“与Gradle文件同步项目”按钮以使IDE拾取更改。
To see a different example of integrating a library project with Android Studio, see using facebook sdk in android studio 要查看将库项目与Android Studio集成的其他示例,请参阅在 Android Studio中使用facebook sdk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.