Aby uruchamiać aplikacje etapowe w emulatorze, musisz spełnić dodatkowe wymagania:
Potrzebujesz emulatora Androida w wersji 27.2.9 lub nowszej.
W emulatorze Androida należy włączyć i włączyć OpenGL ES 3.0 lub nowszą wersję.
Sprawdź, czy emulator jest skonfigurowany do używania najnowszej wersji. W panelu Rozszerzone elementy sterujące
(
na pasku narzędzi Google Toolbar) wybierz Ustawienia > Poziom > Poziom &interfejsu API OpenGL ES;
Maksimum renderowania (do OpenGL ES 3.1), a następnie ponownie uruchom emulator.
Uruchom emulator i krótkim użyciem emulacji, a następnie sprawdź, czy jest używany interfejs OpenGL ES 3.0 lub nowszy:
adb logcat | grep eglMakeCurrent
Jeśli widzisz wersję ver 3 0 lub wyższą, możesz uruchomić aplikacje Sceneform.
Jeśli zobaczysz wersję starszą, oznacza to, że GPU na komputery nie obsługuje OpenGL ES 3.0. Aby uruchamiać aplikacje Sceneform, musisz użyć obsługiwanego urządzenia.
Uruchamianie przykładu
Upewnij się, że Twoje urządzenie z Androidem jest połączone z komputerem programisty, a następnie kliknij Uruchom w Android Studio. Następnie wybierz urządzenie jako miejsce docelowe wdrożenia i kliknij OK.
Android Studio tworzy projekt w pakiecie APK z możliwością debugowania, instaluje plik APK, a potem uruchamia aplikację na Twoim urządzeniu. Więcej informacji znajdziesz w artykule Tworzenie i uruchamianie aplikacji.
Jeśli będzie brakować lub jest ono nieaktualne, możemy Cię poprosić o zainstalowanie lub zaktualizowanie Usług Google Play dla AR. Kliknij DALEJ, aby zainstalować ją ze Sklepu Google Play.
Aplikacja Hello Sceneform umożliwia umieszczanie figurek Androida i manipulowanie nimi na płaskich powierzchniach.
Dodaj etap do istniejącego projektu
Aby użyć funkcji Sceneform w istniejącym projekcie:
[null,null,["Ostatnia aktualizacja: 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)."]]