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
medihack
  • 16,045
  • 21
  • 90
  • 134

2 Answers2

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,654
  • 5
  • 33
  • 57
  • 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). – medihack Jul 23 '16 at 16:53
0

A bit late to the party here. But, are you aware that the directory you listed in the settings, might have a typo?

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

Perhaps this should be, as the project you have cloned named, Android-ReactiveLocation

swalog
  • 4,403
  • 3
  • 32
  • 60