boinc/android/WSL.README.md

3.8 KiB

Building BOINC Android client on Windows (WSL)

Goal

Allow Windows users to use built-in WSL for setting up for BOINC Android development

Known Issues

Prerequisites

Set up Ubuntu

We are going to use Ubuntu 20.04 as an example, other versions should be similar. Refer Prerequisites before proceeding.

  1. Update and install build tools

     $ sudo apt update && sudo apt upgrade
    
     $ sudo apt install git unzip make m4 pkg-config autoconf automake libtool python
    
  2. Clone BOINC repo

     $ git clone https://github.com/boinc/boinc.git ~/boinc
    
  3. Build BOINC Android client

     $ cd ~/boinc/android
    
     $ ./build_client.sh
    

    You should see this once you are done compiling:

     ===== BOINC for all platforms build done =====
    

    If you ever had problem at this point, try git clean -fxd .. and run again

    While waiting please do another repository cloning at Android Studio.

Android Studio

Open Android Studio and choose Get from Version Control

Set URL as https://github.com/boinc/boinc and clone it. When asked about creating Android Studio project, select No.

Once the native client build is complete, copy the native client binaries to cloned repo at Android Studio side. Replace <pathtofolder> with appropriate location.

    $ cp -frv ~/boinc/android/BOINC/app/src/main/assets/* /mnt/<drive>/<pathtofolder>/boinc/android/BOINC/app/src/main/assets/

Then import project from <drive>:\<pathtofolder>\boinc\android\BOINC

After Gradle sync completed, you can now start development or compile the APK.

Workarounds

While WSL1 makes building the native client easily, it is prone to errors and speed issues. You may want to check out workarounds enlisted in the Known Issues section. Note that Microsoft does not recommend this and users are expected do it at their own discretion. You can read more about WSL1 and its issues at Microsoft/WSL#873 (comment). This should be fixed with the release of WSL2.

Tips

  1. Speed up compiling by adding:

     $ MAKEFLAGS="-j$(nproc --all)" ./build_all.sh
    
  2. You can access the current directory via File Explorer by running:

     $ explorer.exe .
    
  3. If you use Visual Studio Code, you can open up the current directory by running:

     $ code .
    
  4. If you need to reset or uninstall Ubuntu, simply:

     Start Menu > right click Ubuntu > More > App Settings