Repository navigation
Build for Android
Marino von Wattenwyl edited this page Jun 21, 2024
·
44 revisions
- Install Android Studio either from developer.android.com or using JetBrains Toolbox
- Install CMake ≥ 3.15
- An Android device in developer mode with USB debugging enabled
- Clone the Git repository into a directory of your choice.
- Open Android Studio.
- Install the Android SDK using the
Android Studio Setup Wizarddialog that opens up.- You can just leave the default options in the
SDK Components Setupscreen.
- You can just leave the default options in the
- In the
Welcome to Android Studiodialog, clickOpen. - Select the directory
<SLProject root directory>/apps/source/platforms/android/example_project/and clickOK. - Go to
Tools > SDK Manager > SDK Tools. - Make sure the checkboxes
NDK (Side by side) > 21.4.7075529andGoogle USB driverare enabled and clickOK. - Plug in your Android device and allow USB debugging for this computer.
- Select your device as the running device in the top bar.
- Build the project by pressing the hammer button or choosing
Build > Make Module 'exampleproject.app'.- SLProject cannot be built for architectures other than
arm64-v8abecause we only provide library prebuilts for this architecture. - This also means that SLProject doesn't run on x86 Android emulators.
- SLProject cannot be built for architectures other than
- After a successful build, click on the green start button to install and launch the app on your device.
- On the left-hand side, switch to the Build Variants tab.
- Set the Active Build Variant to release.
- In the
build.gradlefile, setsigningConfigsto 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 } } - Choose
Build > Build bundle > Build APK - Create your keystore: If you don't have access to the SLProject keystore password, generate a new keystore and update the
build.gradlefile- 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.gradlefile to use your keystore with the provided password.
- Choose Build > Generate Signed Bundle or APK and select APK.