Native 3D Embeds for Android
With our Vulkan-based renderer, you can embed native 3D content in your Android projects.
This native renderer enables you to bring all of the interactivity from your 3D designs made in Spline to Android devices and take full advantage of their native performance.
Requirements
Follow the steps below to get set up to use the Spline Android Runtime.
1. Download and Install Android Studio
We recommend that you use the latest stable version of Android Studio.
To use Spline native embeds, you’ll need to integrate the Spline Android Runtime into a Kotlin or Java project. This means you must install Android Studio to build an Android application. Android Studio is available on Windows and Mac.
Download the latest versions of Android Studio from the Android Developer website.
Getting Started
Follow the steps below to get started using native 3D embeds on your Kotlin or Java projects with Spline Android Runtime.
Platform Support
We recommend Android 10.0+
Spline is using the latest technologies to render 3D content on Android devices.
It runs on Phones, Tablets, Wear OS, Desktop, TV, and Automotive from Android 7.0 and up, but we recommend using Android 10.0+. Vulkan support is required.
Language and Libraries Support
The Spline Android Runtime can be used with Kotlin and Java.
Android Studio Simulator
The performance on the Android Studio simulator is not representative of the performance of the 3D scene on the final app running on physical devices. Depending on your development hardware, the Android simulator sometimes uses only the CPU (lower) or GPU (faster) for rendering graphics. However, the 3D scenes on your device will always use the GPU.
1. Adding the Spline Android Runtime
Open your project's build.gradle.kts
file, and add this line of code under dependencies.
Copy
implementation("design.spline:spline-runtime:+")
Note: This will always run the latest version of the runtime.
After making changes on your build.gradle.kts
file, make sure to press the Sync Now
button to apply the changes.
You can find Spline’s Android runtime hosted on Maven: https://central.sonatype.com/artifact/design.spline/spline-runtime/overview
For more information, refer to Android’s documentation on Adding dependencies to your app.
2. Importing the Spline Android Runtime
To import the Spline Android Runtime, make sure to always add the following code to the top of the file where the Spline Runtime is used.
import design.spline.runtime.SplineView
For cloud embeds, you’ll need to allow your app to have internet access. To do so, you can add these two lines of code to your AndroidManifest.xml
file inside your-app-name/manifests
.
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
3. Using the Spline Android Runtime
3.1 Exporting from Spline
From the top toolbar, press the
Export
button to open the export panel;Under Android Platform, select the
Embed
option.
Make sure to come back to the export panel and press the Update
button to see all the updates made to the scene in your app.
To load your Spline scene locally, you can use the Download the scene to local
button below the code snippet.
3.2 Integrating with your Android Studio Project
Since the embedded code snippet utilizes AndroidView, ensure you include the following line in the file where you are embedding your Spline scene.
import androidx.compose.ui.viewinterop.AndroidView
From the Cloud
Copy the code snippet and paste it on the
MainActivity.kt
file or wherever you’d like to embed the Spline scene.
import design.spline.runtime.SplineView @Composable fun MyView() { AndroidView( factory = { ctx -> SplineView(context).apply { // fetching from cloud loadUrl("https://build.spline.design/r7vufRzuTnbHle7G/scene.splinecontent") // fetching from local // loadResource(R.raw.scene) } } ) }
If not using local files, you can either keep the
fetching from local
code commented or remove it completely.
Locally
Use the Download button below the code snippet to get a local copy of your Spline Scene as a
.splinecontent
file;Import the
.splinecontent
file into your Android Studio project’syour-app-name/res/raw
folder;Copy the code snippet and paste it on the
MainActivity.kt
file or wherever you’d like to embed the Spline scene.;Comment out the
fetching from cloud
code and uncomment thefetching from local
code.
import design.spline.runtime.SplineView @Composable fun MyView() { AndroidView( factory = { ctx -> SplineView(context).apply { // fetching from cloud // loadUrl("https://build.spline.design/r7vufRzuTnbHle7G/scene.splinecontent") // fetching from local loadResource(R.raw.scene) } } ) }
When working with multiple local files, you can change the file name in
R.raw.[file-name]
. If the file name isdemo.splinecontent
the code should look like:R.raw.demo
For more information on adding resources to your project, refer to Android’s documentation on App Resources.
4. Publishing and distributing your app
For more information on publishing to the Google Play Store, refer to Android’s documentation on Publishing your app.
Feature Support Roadmap
Here is a list of each feature's current status. This list will be updated weekly until everything is fully supported.
Feature | Status | Nodes |
---|---|---|
Shapes | ✅ | Subdivs, 3D Paths, Text, and Booleans are baked. |
Materials | ✅ | |
Events & States | ✅ | |
Physics | ✅ | |
Game Controls | ✅ | |
Variables | ✅ | |
Post-Processing | ✅ | |
Particles | ✅ | |
Animated Models | ✅ | |
Multi Scenes | ✅ | |
UI Scenes | 🚧 |
Generate an APK
Export your 3D content for Android devices by generating an Android Package file (APK) directly from Spline.
Learn more about
Generate an App Bundle (AAB)
Export your 3D content for Android devices by generating a pre-built Android App Bundle file (AAB) directly from Spline.
Learn more about