Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Im trying to get used to this new gradle system built into the new Android studio.

I've tried a really basic task, to import the websockets library into my project. So I imported the module via the normal route (File->Project Structure), I imported the java-websockets module in and added it as a dependency too. Finally I import the org.java_websockets class into my project.

My project ended up looking like this:

enter image description here

So this is where my problem starts, I give it a shot and try to build it and run into the usual gradle errors. So I added an 'include' line to my settings.gradle

include ':java-ws-client'

and another one into my build.gradle

compile project(':java-ws-client')

So now I find myself stuck with two problems:

One fairly undescriptive one:

enter image description here

and another:

enter image description here

I've tried updating my android studio to the latest one, and the project above is a fresh one.

How can I avoid pulling my hair out?

share|improve this question
    
Can you try to compile from the command line and see if this works? At this point, it could be an issue with the Gradle integration in Studio or in Gradle. Compiling from the command line helps narrowing it down. Also, you should never change dependencies through the Project Structure dialog (for now) –  Xavier Ducrohet Jul 18 '13 at 0:29

1 Answer 1

From your screenshot, settings.gradle is inside TestProjectProject, which makes TestProjectProject a root project. However, java-ws-client is parallel TestProjectProject, which is outside of TestProjectProject's scope. You cannot reference any project outside its scope using ":foobar" notation.

To fix the second problem, you should either move java-ws-client into TestProjectProject, or declare java-ws-client as an external dependency, and add proper repository resolver to find it.

To fix the first problem, make sure in TestProjectProject/build.gradle you have applied the Java plugin. The Java plugin creates the "default" configuration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.