Android application development using Unity + ARCore on Ubuntu

I am developing an Android application using Unity + ARCore, but I did not find many articles developing on Ubuntu, so I mainly summarized the environment construction. As of this time (2020/12/30), I used the newest versions of Unity and ARCore as much as possible.

Developed app

We have developed an app that puts an object in the place when you tap the screen, which is explained in "Getting Started ARCore in Sapporo". However, the version of ARCore used in this article is a little old, so I changed it to the latest version.

environment

--Development machine

Development environment construction

I will not explain in detail how to install Unity on Ubuntu because there are other commentary articles.

Unity installation

  1. Download Unity Hub from the Download Page (https://unity3d.com/jp/get-unity/download)
  2. Select "*** Click here for Unity Hub details ***"
  3. Find and select "*** Unity Unity Hub v2.0.0 Release ***"
  4. Select "*** Hub for Linux ***" from ** Download Link ** to download
  5. A file called * UnityHub.AppImage * will be downloaded
  6. Grant execute permission $ chmod + x UnityHub.AppImage
  7. Run Unity Hub $ ./UnityHub.AppImage
  8. Install Unity
  9. Select "Install" from the menu on the left and select the "Install" button on the upper right
  10. Unity 2019.4.17f1 (LTS)
  11. Add "*** Android Build Support ***" in the plugin to download

After waiting for a while, the installation is completed.

ARCore installation

  1. Installation of required packages Select "Window-> Package Manager" and install the following packages
    • Multiplayer HLAPI
    • XR Legacy Input Helper
  2. Download the package from "here" (https://github.com/google-ar/arcore-unity-sdk/releases/tag/v1.22.0) arcore-unity-sdk-1.22.0.unitypackage
  3. After opening the Unity project, add the package
  4. Select "Assets-> Import Package-> Custom Package"
  5. Select the * arcole-unity-sdk-1.22.0.unitypackage * downloaded above

Gradle installation

Gradle will also be installed if you add * Android Build Support * when installing Unity, but ARCore requires version 5.6.4 or higher. In my environment, the version of Gradle installed by default is older than this and I got a build error, so I installed it additionally. I installed * version 5.6.4 *.

  1. Download Gradle
  2. Find v5.6.4 from "this page" and select * complete * under * Downlowd *
  3. A file called ** gradle-5.6.4-all.zip ** will be downloaded
  4. Move and extract files
  5. Download and move the file to any directory. I moved to the same directory that contains the Gradle that Unity downloaded $ mv gradle-5.6.4-all.zip ~/Unity/Hub/Editor/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools
  6. Deployment $ unzip gradle-5.6.4-all.zip

Unity build settings

There are other articles that explain in detail here as well, so I will describe them briefly. The following are the settings in the Unity project.

--Change Platform to Android -* File-> Build Settings , select "Android" and press "Switch Platform" --Gradle path setting - Edit-> Preferences-> External Tools-> Android-> Gradle *, uncheck Recommended and select the additionally installed Gradle folder. (For my environment): / home/{user}/Unity/Hub/Editor/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle-5.6.4 --Player settings

Android device recognition

The following settings are required to connect the Android device to Ubuntu and install the app. First connect your Android device to your PC and then run the lsusb command to verify your vendor ID

$ lsusb
Bus 001 Device 015: ID 0fce:520a Sony Ericsson Mobile Communications AB

When multiple USB devices are connected to the PC, the number of results will be output. Look for your Android device in it. At the end of the line is the manufacturer's name, which you can see. The above is the result when Xperia 5 is connected in my environment. * 0fce * in this is the vendor ID. Use this value to add a device connection rule.

$ sudo vi /etc/udev/rules.d/51-android.rules
#Write the following in a file. Vendor ID changes according to the environment
UBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev"

App implementation

The contents of P.50 ~ P.88 of "Getting Started ARCore in Sapporo" have been implemented almost as they are, but only the following changes have been made according to the ARCore version.

reference

Installing Unity on Ubuntu -Note that I installed Unity2020.1 on Ubuntu 20.04

Gradle related

Unity app implementation -Getting Started ARCore in Sapporo -ARCore environment construction and plane detection in Unity 2019

Android device recognition -Settings for connecting the actual Android device on Ubuntu

Recommended Posts

Android application development using Unity + ARCore on Ubuntu
Android application development preparation 7/15
Using Flutter on Ubuntu (Part 2)
Introduction to Android application development
ROS app development on Android
Using Azure IOT Hub on Ubuntu 20.10.
Install ngrok on ubuntu16.04 using Vagrant
[Unity] Android development environment construction procedure
Notes for Android application development beginners
Save ArrayList using GSON on Android
Build Unity development environment on docker
Installing and using Ansible on Ubuntu 16.04
Try using the service on Android Oreo
A memorandum for android application development beginners
Sobel filter using OpenCV on Android (Java)
Notes on creating android plugins for Unity
[Ruby] Building a Ruby development environment on Ubuntu
Try using Firebase Cloud Functions on Android (Java)
Using JUnit from the command line on Ubuntu
[Java] Build Java development environment on Ubuntu & check execution
Tips for using the Spotify app on Ubuntu
Translator using Microsoft Translator Text API on Android ~ Implementation ~
Try communication using gRPC on Android + Java server
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
Android Development App_Preparation
[For beginners] Until building a Web application development environment using Java on Mac OS
tmux on Ubuntu
I tried using a database connection in Android development
Try running ScalarDB on WSL Ubuntu (Sample application creation)
I built an Ubuntu environment on Windows 10 using WSL2.
Run the Android emulator on Docker using Android Emulator Container Scripts
I tried using YOLO v4 on Ubuntu and ROS
Try image classification using TensorFlow Lite on Android (JAVA)
[Introduction to Android application development] Let's make a counter