Für das Ausführen von Sceneform-Anwendungen im Emulator gelten zusätzliche Anforderungen:
Sie benötigen die Version Android EmulatorVersion 27.2.9 oder höher.
OpenGL ES 3.0 oder höher muss im Android Emulator unterstützt und aktiviert werden.
Achten Sie darauf, dass Ihr Emulator so konfiguriert ist, dass er die neueste Version verwendet. Wählen Sie im Bereich "Erweiterte Steuerelemente" ( in der Google Toolbar) die Option Einstellungen > Erweitertes > OpenGL ES-API-Level > Renderer-Maximum (bis zu OpenGL ES 3.1) aus und starten Sie dann den Emulator neu.
Führen Sie den Emulator aus, interagieren Sie kurz mit dem emulierten Gerät und prüfen Sie, ob OpenGL ES 3.0 oder höher verwendet wird:
adb logcat | grep eglMakeCurrent
Wenn ver 3 0 oder höher angezeigt wird, können Sie Sceneform-Apps ausführen.
Wenn Sie eine niedrigere Version sehen, unterstützt Ihre Desktop-GPU OpenGL ES 3.0 nicht. Außerdem müssen Sie zum Ausführen von Sceneform-Anwendungen ein unterstütztes Gerät verwenden.
Beispiel ausführen
Vergewissere dich, dass dein Android-Gerät mit der Entwicklungsmaschine verbunden ist, und klicke in Android Studio auf Ausführen. Wählen Sie dann Ihr Gerät als Bereitstellungsziel aus und klicken Sie auf OK.
Android Studio baut dein Projekt in ein debugfähiges APK auf, installiert das APK und führt die App dann auf deinem Gerät aus. Weitere Informationen finden Sie unter Anwendung erstellen und ausführen.
Sie werden möglicherweise aufgefordert, die Google Play-Dienste für AR zu installieren oder zu aktualisieren, wenn diese fehlen oder veraltet sind. Wähle WEITER aus, um die App aus dem Google Play Store zu installieren.
Mit der App Hello Sceneform können Sie Android-Figuren auf flachen Oberflächen platzieren und bearbeiten.
Sceneform zu einem vorhandenen Projekt hinzufügen
So verwenden Sie Sceneform in einem vorhandenen Projekt:
[null,null,["Zuletzt aktualisiert: 2022-09-26 (UTC)."],[[["\u003cp\u003eInstall Android Studio 3.1+ and Android SDK Platform 7.0+ to set up your development environment, along with basic Android development knowledge.\u003c/p\u003e\n"],["\u003cp\u003eDownload or clone the Sceneform Samples project and open the Hello Sceneform sample in Android Studio.\u003c/p\u003e\n"],["\u003cp\u003ePrepare a supported device or emulator with Google Play Services for AR and ensure it meets the specified requirements for running Sceneform apps.\u003c/p\u003e\n"],["\u003cp\u003eBuild and run the sample app on your device or emulator, potentially installing or updating Google Play Services for AR if needed.\u003c/p\u003e\n"],["\u003cp\u003eTo integrate Sceneform into existing projects, enable ARCore, add the Sceneform library to your app's \u003ccode\u003ebuild.gradle\u003c/code\u003e file, and configure compile options if necessary.\u003c/p\u003e\n"]]],["To get started, install Android Studio (version 3.1+) with Android SDK Platform 7.0+. Download or clone the Sceneform Samples, then open the \"Hello Sceneform\" project in Android Studio. Ensure your device or emulator supports OpenGL ES 3.0 or higher. Run the sample by connecting your device and pressing \"Run.\" To use Sceneform in an existing project, enable ARCore and add the Sceneform library to your app's `build.gradle` file.\n"],null,["# Sceneform Quickstart for Android\n\nSet up your development environment\n-----------------------------------\n\n- Install [Android Studio](https://developer.android.com/studio/index.html)\n version 3.1 or higher with Android SDK Platform version 7.0 (API level 24)\n or higher.\n\n- You will need a basic understanding of Android development. If you are new\n to Android, see\n [Building your first Android app for beginners](//developer.android.com/training/basics/firstapp/index.html).\n\nOpen the sample project\n-----------------------\n\nGet the sample projects. You can either:\n\n- Download and extract the [Sceneform Samples](//github.com/google-ar/sceneform-android-sdk/releases)\n\n -or-\n- Clone the repository with the following command:\n\n \u003cbr /\u003e\n\n ```\n git clone https://github.com/google-ar/sceneform-android-sdk.git\n ```\n\n \u003cbr /\u003e\n\nIn Android Studio, open the **Hello Sceneform** sample project, located in the **app** subdirectory within the `sceneform-android-sdk` directory.\n\nPrepare your device or emulator\n-------------------------------\n\nYou can run AR apps on a [supported device](/ar/discover/supported-devices) or\nin the Android Emulator:\n\n- In the emulator, you must sign into the Google Play Store or [update Google Play Services for AR](/sceneform/develop/emulator#update-arcore) manually.\n\nThere are additional requirements to run\nSceneform apps in the emulator:\n\n- You need **Android Emulator** version **27.2.9** or later.\n- **OpenGL ES 3.0** or higher must be supported and enabled in the Android\n Emulator.\n\n - Make sure your emulator is configured to use the latest version. In the\n Extended controls panel\n (\n on the Toolbar), select **Settings \\\u003e Advanced \\\u003e OpenGL ES API level \\\u003e\n Renderer maximum (up to OpenGL ES 3.1)**, and then restart the emulator.\n\n - Run the emulator, briefly interact with the emulated deivce, then check\n whether OpenGL ES 3.0 or higher is being used:\n\n adb logcat | grep eglMakeCurrent\n\n If you see `ver 3 0` or higher version, then you can run Sceneform apps.\n If you see a lower version, then your desktop GPU does not support\n OpenGL ES 3.0 and you must use a\n [supported device](/ar/discover/supported-devices) to run Sceneform\n apps.\n\nRun the sample\n--------------\n\nMake sure your Android device is connected to the development machine and click\n**Run** in Android Studio. Then, choose your device\nas the deployment target and click **OK**.\n\nAndroid Studio builds your project into a debuggable APK, installs the APK, and\nthen runs the app on your device. For more information, see [Build and Run Your App](//developer.android.com/studio/run/index.html).\n\nYou may be prompted to install or update [Google Play Services for AR](//play.google.com/store/apps/details?id=com.google.ar.core)\nif it is missing or out of date. Select **CONTINUE** to install it from\nGoogle Play Store.\n\nThe **Hello Sceneform** app lets you place and manipulate Android figurines on\nflat surfaces.\nYour browser does not support the video tag.\n\nAdd Sceneform to an existing project\n------------------------------------\n\nTo use Sceneform in an existing project:\n\n1. Follow the steps to [Enable ARCore](/ar/develop/java/enable-arcore) in your app\n\n2. Add the Sceneform library to your **app's** `build.gradle` file:\n\n android {\n // Sceneform libraries use language constructs from Java 8.\n // Add these compile options if targeting minSdkVersion \u003c 26.\n compileOptions {\n sourceCompatibility 1.8\n targetCompatibility 1.8\n }\n }\n\n dependencies {\n ...\n\n // Provides ArFragment, and other UX resources.\n implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.15.0'\n\n // Alternatively, use ArSceneView without the UX dependency.\n implementation 'com.google.ar.sceneform:core:1.15.0'\n }\n\nNext steps\n----------\n\n- Try building and running [other sample projects](/sceneform/develop/samples) in the ARCore SDK and Sceneform samples.\n- Learn how to [Enable ARCore](/ar/develop/java/enable-arcore) in your app.\n- Review [Runtime Considerations](/ar/develop/developer-guides/runtime-considerations).\n- Review [Design Guidelines](/ar/develop/developer-guides/design-guidelines)."]]