简体   繁体   中英

Upgraded gradle version Android Studio Ubuntu 20.04 LTS

I just upgraded my android studio version and gradle version to the new one as AS suggest me. But now every time I try to build my project gradle has this error:

Could not create parent directory for lock file /opt/android-studio/plugins/gradle/wrapper/dists/gradle-7.5-bin/f1w0cc9nuo0eivz97x2xlu9sv/gradle-7.5-bin.zip.lck

Of course it worked perfectly fine before upgrade and I didn't change anything manually in path or version used.

I know it's a permission error, but I tried to build it as sudo, it downloaded and installed correctly but once I went back to a normal user process, it can't recognize that gradle has already been installed on my system. I have this error

The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.5-bin.zip' does not exist.

knowing I didn't change anything in my path or used version while swapping between sudo and normal user. Does anyone know how to force AS to detect and use already installed gradle version?

One option will be to open Android Studio's settings:

Build, Excecution, Deployment > Build Tools > Gradle

and from there you can specify whether to use Gradle from gradle-wrapper.properties file or from a specified location. The latter should fit your needs.

Tested with AS Chipmunk and Dolphin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM