Gradle sync failed: Authentication scheme 'all'(Authentication) is not supported by protocol 'file'

Does anyone know this gradle sync fail?
I’ve upgraded android studio from v1.5 to v2.0, and I’ve s struck on this problem for several day, really frustrated!

gradle sync failed: Authentication scheme ‘all’(Authentication) is not supported by protocol ‘file’

@droneboost

I found that when I had my Maven Repository configured to point to a local file location, I encountered the same error when I tried to also use credentials with that local repository:

def uploadRepo = "file://${rootProject.buildDir}/libs"
publishing{
    repositories{
        maven{
            url uploadRepo
            credentials(PasswordCredentials){
                username "*****"
                password "*****"
            }
        }
    }
}

This would fail. Changing the uploadRepo variable to a valid URL fixed the issue. Also, removing the credentials resolved the issue and allows me to upload to a local repository:

def uploadRepo = "file://${rootProject.buildDir}/libs"
publishing{
    repositories{
        maven{
            url uploadRepo
        }
    }
}

Hope that helps!