Skip to content

Build for Android

Marino von Wattenwyl edited this page Jun 21, 2024 · 44 revisions

Requirements

Building and Running

  1. Clone the Git repository into a directory of your choice.
  2. Open Android Studio.
  3. Install the Android SDK using the Android Studio Setup Wizard dialog that opens up.
    • You can just leave the default options in the SDK Components Setup screen.
  4. In the Welcome to Android Studio dialog, click Open.
  5. Select the directory <SLProject root directory>/apps/source/platforms/android/example_project/ and click OK.
  6. Go to Tools > SDK Manager > SDK Tools.
  7. Make sure the checkboxes NDK (Side by side) > 21.4.7075529 and Google USB driver are enabled and click OK.
  8. Plug in your Android device and allow USB debugging for this computer.
  9. Select your device as the running device in the top bar.
  10. Build the project by pressing the hammer button or choosing Build > Make Module 'exampleproject.app'.
    • SLProject cannot be built for architectures other than arm64-v8a because we only provide library prebuilts for this architecture.
    • This also means that SLProject doesn't run on x86 Android emulators.
  11. After a successful build, click on the green start button to install and launch the app on your device.

Creating a Release Build

  1. On the left-hand side, switch to the Build Variants tab.
  2. Set the Active Build Variant to release.
  3. In the build.gradle file, set signingConfigs to the password of the SLProject keystore.
    signingConfigs {
        release {
            keyAlias 'slproject-release-key'
            keyPassword '....' // Change to your key password
            storeFile file('../slproject-release-key')
            storePassword '....' // Change to your store password
        }
    }
    
  4. Choose Build > Build bundle > Build APK
  5. Create your keystore: If you don't have access to the SLProject keystore password, generate a new keystore and update the build.gradle file
    • Choose Build > Generate Signed Bundle or APK and select APK.
      • Create or choose a signed keystone file in a secure file location.
      • Fill in the Key store password, Key alias and Key password and click Next.
      • Choose release and press Create. The APK gets signed and written to the destination folder.
    • Then modify the build.gradle file to use your keystore with the provided password.

Clone this wiki locally