Solution For Bazel is Not Setting Up Properly On Windows. #5672
Replies: 3 comments 3 replies
-
Trouble Setting Up Oppia Android (Issue #5607, Help & Settings Screens)Hi, first of all, thank you so much for the detailed setup guide — it really helped me get Oppia Android installed and set up on my machine. I appreciate the time and effort you put into making it easier for contributors like me. I’m now trying to contribute to issue #5607 (Help & Settings screens), I followed the setup guide but I'm getting this error:
I'm using:OS: Windows 11 + WSL2 Ubuntu 22.04.5 LTS Bazel version: 6.5.0 Java version: openjdk 17.0.18 Android Studio: Giraffe (running inside WSL) Android SDK location: /home/anmol_aovswlk/Android/Sdk Python2 version: 2.7.18 GCC version: 11.4.0 Memory: 7.8 GiB RAM, 8 GiB Swap (currently ~5.2 GiB used) Disk: C: 355G total, 96G free I tried:Reinstalling Bazel Cleaning the project (bazel clean --expunge) Running scripts/setup.sh again Checking my Android SDK and environment variables Problem on Physical Device:USB debugging is enabled, but Android Studio inside WSL does not detect the device reliably. Issues / QuestionsAfter following the setup and build scripts, I get red errors in the project.(I am pasting a Screenshot along with this) Physical device not detected in Android Studio running in WSL, even with USB debugging enabled. I want to test changes faster—can I use a physical device in WSL? Or is there a better/faster way? Bazel builds are slow, sometimes my laptop memory fills up. Any tips to speed this up safely? Please guide me on what I might be missing? Any tips to fix the error and/or speed up testing would be really appreciated. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @anmoltrvd01, great to see you are interested in Oppia! Honestly, the emulator crashing is likely just a hardware bottleneck rather than a mistake in your setup. Android Studio and its emulators are quite system heavy even my own machine with 16 Gigabytes of RAM struggles with them. I usually use a physical device for testing for that exact reason. Android Studio on WSL won't see a USB connected phone by default because Windows doesn't share USB ports with Linux out of the box. Setting up a USB bridge can take up a lot of your time, so I’d recommend wireless debugging instead. It usually works with WSL out of the Box. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @anmoltrvd01, Thank you for your interest in Oppia. I completely agree with @ShankhanilSaha point. The issue seems to be related to system hardware limitations rather than anything on your end. I was initially going to suggest using Linux, as I use it myself. However, since your system has only 8GB of RAM, setting up a dual boot may not be very practical. If you do not need Windows, you could consider switching entirely to Linux. Otherwise, I would recommend trying the suggestions provided by ShankhanilSaha. |
Beta Was this translation helpful? Give feedback.




Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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 upgradeStep 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/SdkDownload 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.0Step 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_binaryWork 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