Build and deploy

Now that we have all the tedious installation stuff out of the way, it's time to build and deploy a sample app to your Android device. Let's begin by jumping back to Android Studio and following the given steps:

  1. Select the Open an existing Android Studio project option from the Welcome to Android Studio window. If you accidentally closed Android Studio, just launch it again.
  2. Navigate and select the Androidarcore-android-sdksamplesjava_arcore_hello_ar folder, as follows:
Selecting the ARCore sample project folder
  1. Click on OK. If this is your first time running this project, you will encounter some dependency errors, such as the one here:
Dependency error message
  1. In order to resolve the errors, just click on the link at the bottom of the error message. This will open a dialog, and you will be prompted to accept and then download the required dependencies. Keep clicking on the links until you see no more errors.
  2. Ensure that your mobile device is connected and then, from the menu, choose Run - Run. This should start the app on your device, but you may still need to resolve some dependency errors. Just remember to click on the links to resolve the errors. 
  3. This will open a small dialog. Select the app option. If you do not see the app option, select Build - Make Project from the menu. Again, resolve any dependency errors by clicking on the links.
"Your patience will be rewarded."
                                                      - Alton Brown
  1. Select your device from the next dialog and click on OK. This will launch the app on your device. Ensure that you allow the app to access the device's camera. The following is a screenshot showing the app in action:
Sample Android ARCore app running; the dog is real

Great, we have built and deployed our first Android ARCore app together. In the next section, we will take a quick look at the Java source code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.156.251