简体   繁体   中英

Build dependencies with gradle, Android Studio, ADT

I am developing Android app with gradle project. My teammates use ADT, and I do Android Studio and I would like to try my best not to force limiting IDE for others.

As far as I know, ADT needs to have local dependencies (.jar or local lib).
Also if I have main project and local library which contains same local jar files, it cannot build with gradle due to "IllegalArgumentException: already added".

Settings below works fine with gradle and Android Studio but not for ADT, support v13 is not found.

Is there any way to make build works for gradle, Android Studio and ADT ?

Please let me know if you need more information.

My project setting looks like

settings.gradle

include: ':MyProj'
include: ':libs:PagerSlidingTabStrip'

build.gradle (MyProj's)

.....
dependencies {
    compile 'com.android.support:support-v13:13.0.+'
    compile project(':libs:PagerSlidingTabStrip')
}
.....

build.gradle (PagerSlidingTabStrip's)

.....
dependencies {
    compile 'com.android.support:support-v13:13.0.+'
}
.....

You will have to do the following:

  • Make an Eclipse project for MyProject and libs/PagerSlidingTabStrip
  • In MyProj, create a libs folder and dump in it both support-v13 and support-v4.

Do NOT change build.gradle to dep on the content of libs/ or you'll have a duplicate class file issue.

This is manageable if you have only one lib project and few dependencies. If your setup become more complex it'll become impossible to manage (hopefully by then we have Gradle support in Eclipse)

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