I am going to convert my Android projects from Ant to Gradle.
My Eclipse workspace is very simple:
Workspace
MyApp
MyApp-AndroidLibrary
When I add a build.gradle file in MyApp, I want to reference my Android library project:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':MyApp-AndroidLibrary')
}
When I run gradle build, there is an error "Project with path ':MyApp-AndroidLibrary' could not be found in root project", I googled for this, and found I need to setup a "settings.gradle" file in my workspace directory, to add
include ":MyApp"
include ":MyApp-AndroidLibrary"
This looks too bad for me, why Gradle need a settings.gradle file, why not just extract the projects I defined in the dependencies?
And what include
really means? What if I have anotoher app and some other shared libraries in workspace, the structure may look like this:
Workspace
App1
App2
Library1(Used by App1 & App2)
Library2(Used only by App1)
Library3(Used only by App2)
Because there is only ONE settings.gradle file, I had to add them all into settings.gradle. That does not smell good.
And yes, I can re-organize the strucuture to make Library2 into a child directory of App1, and Library3 to be a child directory of App2, but what about Library1?
Any comment on this?