0

I am trying to add a local library project that I cloned (and modified a bit) from Github (Android-ReactiveLocation) as a dependency to my application.

According to this answer it should be as easy as:

settings.gradle

include(':reactivelocation')
project(':reactivelocation').projectDir = new File(settingsDir, '../Andrdoid-ReactiveLocation')

build.gradle in my app directory

dependencies {
  ...
  compile project(':reactivelocation')
}

Unfortunately I get the error

Error:Configuration with name 'default' not found.

As soon as I add the compile statement. What am I doing wrong?

I also tried to use compile project(':reactivelocation:android-reactive-location') as I am only interested in this module library inside Android-ReactiveLocation, but this also fails

Project with path ':reactivelocation:android-reactive-location' could not be found in project.

Update. Some other things I tried without success (same error):

settings.gradle

include(':android-reactive-location')
project(':android-reactive-location').projectDir = new File(settingsDir, '../Andrdoid-ReactiveLocation/android-reactive-location')

build.gradle in my app diretory

dependencies {
  ...
  compile project(':android-reactive-location')
}

settings.gradle

include(':Android-ReactiveLocation')
project(':Android-ReactiveLocation').projectDir = new File(settingsDir, '../Andrdoid-ReactiveLocation')

build.gradle in my app diretory

dependencies {
  ...
  compile project(':Android-ReactiveLocation')
}

settings.gradle

include(':Android-ReactiveLocation:android-reactive-location')
project(':Android-ReactiveLocation:android-reactive-location').projectDir = new File(settingsDir, '../Andrdoid-ReactiveLocation/') // also with '../Andrdoid-ReactiveLocation/android-reactive-location'

build.gradle in my app diretory

dependencies {
  ...
  compile project(':Android-ReactiveLocation:android-reactive-location')
}
Community
  • 1
  • 1
Zardoz
  • 15,245
  • 21
  • 84
  • 130
  • Why did you clone the library? https://github.com/mcharmas/Android-ReactiveLocation#how-to-use-it – OneCricketeer Jul 23 '16 at 17:23
  • Do develop that library further in the context of my app. I can then directly manipulate that library and see how it behaves in my app. Makes development of both much easier. – Zardoz Jul 23 '16 at 17:30
  • Did you try `:Android-ReactiveLocation:android-reactive-location`? – OneCricketeer Jul 23 '16 at 17:35
  • Yep (see edit above) ... same error. – Zardoz Jul 23 '16 at 17:46
  • What is the output of ./gradlew tasks ? – jonathanrz Jul 23 '16 at 17:51
  • @jonathanrz I uploaded [the output of `gradle -info` to Gist](https://gist.github.com/medihack/10c80e19a1b531c2ec4def709c94a80b). – Zardoz Jul 23 '16 at 18:11
  • @Zardoz run with --stacktrace please – jonathanrz Jul 23 '16 at 18:19
  • @jonathanrz [stacktrace](https://gist.github.com/medihack/1e727244727db009a652233ec8650832), not very informative :-/ – Zardoz Jul 23 '16 at 18:26
  • @Zardoz the module android-reactive-location has a build.gradle file in the module root directory? Looking for the error, it seems that gradle can´t find a way to build the module. – jonathanrz Jul 23 '16 at 23:16
  • @Zardoz I believe that this answer has info that can be useful for you: http://stackoverflow.com/questions/22547364/configuration-with-name-default-not-found-android-studio – jonathanrz Jul 23 '16 at 23:18

1 Answers1

1

I have a similar scenario in my project. In build.gradle in app directory you should add path before the library name:

compile project(path: ':reactivelocation')

In my project every things work whit above line. My settings.gradle is exactly like yours.

Misagh Emamverdi
  • 3,584
  • 4
  • 28
  • 54
  • Nope, the error remains (my version is just a shortcut). I guess it has something to do with how [Android-ReactiveLocation](https://github.com/mcharmas/Android-ReactiveLocation) is set up. It contains a subfolder (`android-reactive-location`) were the real library lives. Unfortunately it is not possible to use this folder as `projectDir` directly as the [`build.gradle`](https://github.com/mcharmas/Android-ReactiveLocation/blob/master/android-reactive-location/build.gradle) depends on stuff in the root (e.g. see `compileSdkVersion` in that file). – Zardoz Jul 23 '16 at 16:53