build.gradle problems stopping me from creating my first Android project

Answered

Hi all. Absolute newcomer to Android. 

When I try to create my first Android project, the build won't finish successfully. I get:

 

Could not create parent directory for lock file /Users/((myname))/Documents/Coding/MyFirstApp2/Users/((myname))/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1-all.zip.lck

Frankly before then I got 

':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:29.+

I went on stack overflow for remedies. I read that you should go to Fie > Settings > gradle > and unclick the Offline option...I could not find that but in going to the Build Tools option and retyping in the gradle home input (Users/((myname))/.gradle)), this new "could not create parent directory for lock file" error message.

Should I download Android Studio separately? What do I do? Thanks.

Alex

 

0
19 comments

Hi Yaroslav, thanks...the first solution said I should try to select "Use default gradle wrapper (recommended)". But as you can see, when I go to Build, Execution, Deployment >> Build Tools >> Gradle, I don't even get that option. Here's what I get...thanks!

1

hi yaroslav... i tried another solution on the thread: to delete both the .idea and .gradle folders in the project, then restart intellij idea. here's what i got:...thanks!

0

What about permissions: "This error causing by the folder .gradle is not granted the appropriated right to start working. So open the "get info" and give it all the "Read & write", don't forget to choose "Apply to enclosed items""?

0

Thanks, where on the page do I access "get info"?

0

also, I am using intellij idea for Mac, in case that changes how I access "get info" and "sharing and permissions." Thanks Yaroslav!

0

You need to open your project folder in Finder. There should be ".gradle" directory. Right click on it and select "Get Info".

0

Thanks Yaroslav, I did what you said. 

Now when I open up a project I get the message:

Could not create parent directory for lock file /Users/alexanderselby/Documents/Coding/MyFirstApp2/Users/alexanderselby/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1-all.zip.lck

Here is what I see in intellij IDEA:

Here's what I see when I open my project up in Finder:

Finally here's what I see under Build Tools in Build, Execution, Deployment >> Grade:

Should I have Users in my Finder? Should I change the .gradle home folder in Build Execution Deployment?

And for good measure here's what I see when I open the project. Plenty of red:

Thank you, Yaroslav! You are very patient with me.

Alex

 

 

 

 

 

 

0

Alex,

>Should I change the .gradle home folder in Build Execution Deployment?

It's not necessary.

Seems leading slash is missing in Gradle home path. Please change it to "/Users/alexanderselby/.gradle/"

 

 

 

0

Okay, great, thx Yaroslav...

now the issue is I get the following message:

build.gradle: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:29.+.

I updated my APIs but it says that my API 29 is only "Partially Installed"...could that be a problem?

Here's what I see when I open my project:

Thanks Yaroslav!

Alex

0

Alex,

What IDE version do you use? Please try 2019.2.1 - related issue should be fixed there.

 

0

I have ultimate 2019.2

So 2.1 is different? I'll look for an upgrade and let you know.

0

No actiually I do have 2019.2.1. Should I re-download?

0

would it be ok if I uninstalled it and reinstalled it? Is that risky? Thanks Yaroslav.

0

Alex,

Could you please try to recreate project from the scratch?

0

Just did, created new project, same issue

0

So many libraries and resources appear unavailable to me. My computer is in good condition. No clue what to do. Thanks for your help Yaroslav.

0

Should I unclick API 29 in my SDK manager, since that's only Partially Installed and it appears the proglem is associated with API 29 trying to be compiled?

 

Recall that I get this message when gradle tries to build:

build.gradle: Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+.

0

Please sign in to leave a comment.