-
Notifications
You must be signed in to change notification settings - Fork 1
Build for Android
Marcus Hudritsch edited this page Jun 27, 2024
·
44 revisions
- An Android device in developer mode with USB debugging enabled
- Android Studio (can be installed from developer.android.com or using JetBrains Toolbox)
- CMake ≥ 3.15 (Download)
- Clone the Git repository into a directory of your choice.
- Open Android Studio.
- 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.
- You can just leave the default options in the
- In the
Welcome to Android Studio
dialog, 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.7075529
andGoogle USB driver
are enabled and clickOK
. - Make sure that cmake 3.22.1 is installed.
- Make sure the checkboxes
- 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'
.- By this, you are building the app_demo_slproject 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.
- After a successful build, click on the green start button to install and launch the app on your device.
- Go to
File > Settings... > Build, Execution, Deployment > Gradle-Android Compiler
. On Macs the settings are underAndroid Studio > Settings...
. - Set
Command-line Options
to-PappLibraryName=<Name of your app>
.- To build the node demo, enter
-PappLibraryName=app-Demo-Node
. - To build the example app from the guide to creating a new app, enter
-PappLibraryName=app-Example
.
- To build the node demo, enter
- Build and start again.
- On the left-hand side, switch to the Build Variants tab.
- Set the Active Build Variant to release.
- In the
build.gradle
file, setsigningConfigs
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 } }
- 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.gradle
file.- Choose
Build > Generate Signed Bundle or APK
and selectAPK
.- Create or choose a signed keystone file in a secure file location.
- Fill in the
Key store password
,Key alias
andKey password
and clickNext
. - Choose
release
and pressCreate
. The APK gets signed and written to the destination folder.
- Then modify the
build.gradle
file to use your keystore with the provided password.
- Choose