Error: Could not find or load main class org.gradle.wrapper. GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: /gradlew app:installDebug.
If you are getting the above error while working on your Android Project in Android Studio, well this can be solved by following the below steps.
Step 1:
The first thing you should do is make sure that gradlew (or gradle.bat) file is present in your project root folder.
If you see these files are missing then you will need to add the Gradle Wrapper
Run the below command as per your Operating System:
Read More: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper
Step 2:
Now check the Gradle version just to be sure it has been installed correctly.
gradle --version
Step 3:
Another thing that you can do is check if ANDROID_HOME environment variable is set correctly.
Windows: echo %ANDROID_HOME%
macOS/Linux: echo $ANDROID_HOME
Step 4
Try to re-build your project.
Windows: gradlew clean
macOS/Linux: ./gradlew clean
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Run only a Single Unit Test using Gradle
- Run IntelliJ Java main method without Gradle build
- How to force re-download Gradle Dependencies
- How to Run Gradle Build Without Unit Test Cases
- Find installed Gradle version command
- Fix: Invalid Gradle JDK configuration found. Could not find the required JavaSDK
- Generate Project Dependency tree using Gradle Command
- Installing Gradle on macOS - Gradle Tutorial
- Gradle FAILURE: Build failed with an exception - Task not found in root project
- [Fix] ./gradlew: Permission denied
- Force Gradle to use specific Java JDK Version
- [fix] Deprecated gradle features were used in this build, making it incompatible with Gradle X.0
- Create a Gradle Java Project in VS Code
- Install Gradle VS Code for Java Projects
- Fix: Unsupported Java. Your build is currently configured to use Java 17.0.5 and Gradle 7.1.
- How to create Gradle Multi-Project in IntelliJ
- Fix: Spring Boot + IntelliJ + Gradle : Unsupported class file major version 64 Error
- Fix: Error: Could not find or load main class org.gradle.wrapper. GradleWrapperMain
- [fix] bash: gradlew: command not found
- [fix] Execution failed for task :core:compileJava - Could not find tools.jar
- Run Gradle Build without test cases
- How to add maven central repository in build.gradle
- Upgrade Gradle in Android Studio
- Task is ambiguous in root project gradle-examples. Candidates are: myTask1, myTask2
- Fix: Deprecated Gradle features were used in this build, making it incompatible with Gradle
- TextEdit: Disable Autocorrect Option (Mac) - MacOS
- How to check zsh installed version using terminal - MacOS
- How to delete SharePoint Online List Item using REST API - SharePoint
- How to use HashTags # correctly on Social Media Facebook Twitter - HowTos
- How to convert Milliseconds to Date in Java 8 and Above - Java
- How to List the SHA Digest of Docker Images - Docker
- SharePoint error cannot connect to the configuration database - SharePoint
- How to Identify installed PowerShell version - Powershell