Solution For Bazel is Not Setting Up Properly On Windows. #5672
Unanswered
TanishMoral11
asked this question in
Q&A (Installation)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Operating System
Windows 11
Android Studio Version
Giraffe
RAM size
16 GB
Free disk space
50 GB
Which step are you stuck on?
Bazel is not setting up properly on Windows.
Error Log
Approaches already used to resolve the issue
Here's a step-by-step guide to help you through it. It will be easy to follow, and throw in some tips along the way.
1. If You're on Windows, Here's My Suggestion
Okay, if you're using Windows, please consider dual-booting Ubuntu 22.04.
Why? Windows has a few annoyances like long path issues and Bazel plugin issues that could drive you crazy. On Ubuntu, everything just works much smoother, especially for development. 🖥️✨
Also, when you're setting up Ubuntu, I recommend installing the Android Studio Giraffe version. Trust me, it's a good idea.
2. Getting Started on Ubuntu 22.04
Alright, let's get down to business! Open up that Ubuntu terminal and let's start.
Step 1: Update Your System
First things first, let's make sure your system is up to date:
$ sudo apt update && sudo apt upgrade
Step 2: Install JDK 17 and Dependencies
You'll need OpenJDK 17 for Bazel to run properly. Here's how to install it:
Next, we'll install Python 2 and GCC:
Step 3: Set Up the Android SDK
Let's set up the Android SDK. First, create the SDK folder:
$ mkdir -p $HOME/Android/Sdk
Download the command line tools from here and then run:
Now, let's move the files into the correct folder:
Set up the environment variables for Android SDK:
Now install the necessary Android SDK components:
Step 4: Install Bazel
Let's move on to Bazel. Here's how you can install it:
If you see Bazel 8.0.0, no problem, just install the version you need:
$ sudo apt install bazel-6.5.0 $ bazel --version # This should show bazel 6.5.0 now!
If it's still not switching, you can force it like this:
$ sudo rm /usr/bin/bazel $ sudo ln -s /usr/bin/bazel-6.5.0 /usr/bin/bazel $ bazel --version # Confirm it's bazel 6.5.0
Step 5: Set Up Your Oppia Project
Let's get your Oppia project ready. First, create a folder for it:
Clone the Oppia Android repo:
Run the setup script:
If you run into a Permission Denied error, just fix the permissions:
You should see messages like this:
Step 6: Build Oppia
Let's build the project with Bazel:
You should see something like this:
Step 7: Running and Installing the APK
Now, to build and install the APK with the latest changes on your emulator, you need this command:
This is your life-saver command! :) Save it somewhere — you'll thank me later!
Step 8: Troubleshooting Tips
Laptop Crashing During Build?
If your laptop crashes while building, don't worry! Just close Android Studio and any unnecessary background processes. Then try running the build again On Ubuntu Terminal:
$ bazel build //:oppia_dev # or $ bazel mobile-install //:oppia_dev_binary
Work in the Terminal (You're a Developer, After All!)
Try to do as much as possible directly in the Ubuntu terminal. You'll be way more productive, plus it just feels like you're a true developer. :)
Low SWAP RAM?
If your system is getting slow, increase your SWAP RAM to at least 8 GB. Trust me, it'll make a big difference.
Happy Coding! 🎉
Additional information
Special Thanks : @adhiamboperes @Rd4dev
Beta Was this translation helpful? Give feedback.
All reactions