1

I'm trying to build a project dependent on ActionbarSherlock in Android Studio.

After much reading I've ended up having a working build, but only if I nest the ABS project inside my main project like so:

MainProject
MainProject\ABS (copied here and then used import module)
MainProject\MainModule (the one created by the wizard)

I had to edit the various Gradle files, settings.gradle is as follows:

include ':OnTop'
include ':ActionbarSherlock'

I fixed the dependencies in the build.gradle files accordingly.

This is suboptimal, I think. Surely I don't want to replicate the ABS module in every new project that uses it? What should I be doing instead?

Ben
  • 51,770
  • 36
  • 127
  • 149
marcopar
  • 366
  • 1
  • 9
  • See [How do I add a library project to the Android Studio?](http://stackoverflow.com/a/16639227/1693859). That guy explained step by step. – Sam R. Jun 09 '13 at 21:14
  • hello, any luck on this issue? did you managed to properly organize shared library projects? – Kid24 Jul 19 '13 at 01:29

2 Answers2

0

Every step are here : How do I add a library project to Android Studio?

If you want to more about gradle see the Google I/O conference by Xavier Ducrohet on youtube : http://www.youtube.com/watch?v=LCJAgPkpmR0

Community
  • 1
  • 1
  • 1
    That solution produce a project that's like mine, with ABS embedded in the project tree (in fact i read that ansewer among many others). What i am asking is how to keep the ABS library outside the project so it can be shared among many projects. – marcopar Jun 10 '13 at 08:05
  • ActionBarSherlock is a module on your project. What you want is a module which is independant. I don't know if it's possible. –  Jun 10 '13 at 22:41
0

I searched this issue enough and finally these are my results:-

This sample project

-> project root

d:\asprojects\thisproject

-> module

d:\asprojects\thisproject\MyModule

-> libraries

d:\asprojects\lvl

d:\asprojects\MyLibrary

-> jars

D:/asprojects/android-support-v4.jar

D:/asprojects/GoogleAdMobAdsSdk-6.4.1.jar

-If you want to use external (outside the project) libraries then the settings.gradle has to point to it like so:-

settings.gradle

include ':lvl', ':MyLibrary', ':MyModule'
project(':MyLibrary').projectDir = new File('D:/asprojects/MyLibrary')
project(':lvl').projectDir = new File('D:/asprojects/lvl')

-Then you need to setup the build.gradle for the MyModule correctly like so:-

build.gradle

dependencies  
{ 
compile files('D:/asprojects/android-support-v4.jar') 
compile files('D:/asprojects/GoogleAdMobAdsSdk-6.4.1.jar') 
compile project(':lvl') compile project(':MyLibrary')   
}

-But the IDE will not like these absolute paths and will say not found.

-But gradlw from commandline work justs fine:-

gradlew clean
gradlew build
gradlew installRelease
etc
Lakshman Chilukuri
  • 1,067
  • 2
  • 11
  • 20