简体   繁体   中英

issue importing maven project - android studio

I am trying to import a project in Android Studio and I am very new to this ide . So, I created some Libraries folder, copied inside the file and then added one line (the last one) to to my 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"

When I launch the gradle build I get

    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

在此处输入图片说明

The basic problem is that you need to have a file that tells Gradle where to find the library; 文件,该文件告诉Gradle在哪里可以找到该库。 it's not enough to put a path spec in your file. 文件中放置路径规范是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 file will look like this: 文件将如下所示:

include ':NewsFeeder'
include ':iconicDroid-master'

You will need to set up a Gradle build file for your library; 库设置一个Gradle构建文件; I wouldn't recommend trying to mix Gradle and Maven builders in the same project.

After you modify or files, click the button in the toolbar to make the IDE pick up the changes. 文件后,单击工具栏中的按钮以使IDE拾取更改。

To see a different example of integrating a library project with Android Studio, see using facebook sdk in android studio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM