2

I've got a project with a shared lib. The folder structure is the following: RootProjects that contains the folders lib and app.

In my settings.gradle I have

include ':app', ':..:lib:app'

and in build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':..:lib:app')
}

Now if I switch from:

classpath 'com.android.tools.build:gradle:1.5.0'

to

classpath 'com.android.tools.build:gradle:2.0.0-beta6'

I receive the following error from Android Studio:

cannot change dependencies of configuration ':..:lib:classpath' after it has been resolved
greywolf82
  • 21,813
  • 18
  • 54
  • 108
  • Did you try with the latest version (2.0.0-beta6)? – Gaëtan Feb 27 '16 at 10:42
  • @Gaëtan same problem – greywolf82 Feb 27 '16 at 10:45
  • Check that the actual names of you lib and app folders do not start with a capital letter. – RaGe Feb 27 '16 at 14:34
  • @RaGe I created a new project called "example" lowercase and a new library project called "lib" lowercase. Same problem. It's fully broken. – greywolf82 Feb 27 '16 at 14:50
  • Sorry, I got it the otherway around, needs to be a starting capital letter. See here: http://stackoverflow.com/a/35013614/745574 If that doesn't help can you upload your sample project to github? – RaGe Feb 27 '16 at 15:49
  • @RaGe It doesn't work but it seems the problem is the ':..:' part. If I create a symbolic link in the app folder to point to library project and then I use in settings. gradle include ':app', ':MyLibraryProject:mylibrary' instead of include ':app', ':..:MyLibraryProject:mylibrary' gradle builds. – greywolf82 Feb 27 '16 at 16:02

1 Answers1

1

Maybe your local gradle distribution is corrupted. Check the projects and make sure all gradle files point to the same gradle version(2.0.0-beta6 in your case). Close Android Studio delete .gradle folder from your pc (the folder located in your home directory of your computer). Then open the project again.

Silverstorm
  • 15,398
  • 2
  • 38
  • 52