简体   繁体   中英

Unable to generate Gradle files

I have imported a project from GitHub into Android Studio, however there is not a gradlew nor gradle.bat file.

I read about how I could generate them from questions like this one , so I ran the following command in the terminal:

gradle wrapper

However, I was given an error:

'gradle' is not recognized as an internal or external command,
operable program or batch file.

Also, in Android Studio, I have set the following setting:

Build, Execution, Deployment > Build Tools > Gradle [For current project]

...

  • Project-level settings

    [x] Use default gradle wrapper (recommended)
    [ ] Use local gradle distribution...

...

So my question is, how can I resolve the error and generate the gradlew and gradle.bat files?

It seemed as though in my case, I had deleted gradle wrapper files (I was trying to edit my GitHub project by importing it to Android Studio, and I had deleted the original files that I uploaded. I accidentally put in .gitignore to not upload those files to GitHub so they weren't there when I imported the project). I found them in my recycle bin and restored them.

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