Install a development environment Unity/Android/SDK(Robot) for Windows

Env-Developpement-SDK-Win

With this tutorial, we will go through the installation and configuration steps to setup a Windows development environment for developing robotic applications.
Specifically, the environment is comprised of Unity3d, Android Studio and a dedicated Robot SDK.

The minimum PC requirement to achieve this installation is minimal : compatible video card DX9 (or above) along with Windows 7 (or above).
If you plan on building complex solutions, be aware Unity can be resource hungry, especially when comes time to display 3d graphics. We hence recommend going above and beyond the minimum PC requirement mentioned above.

Please follow, step by step and in the order provided, the instructions below for the installation:
1 – Installation of Unity3D version 5.x
2 – Installation of Java Developper Kit (JDK)
3 – Installation of Android Studio bundle
4 – Installation of the Robot SDK (Sphero)
5 – Configuration of Android Studio
6 – Installation of Sphero Plugin for Unity
7 – Download and install of standalone Android SDK Tool
8 – Create your first Android Build using Unity3d

This tutorial is based on the installation of the Sphero robot SDK which serves as a learning proxy, pending the availability of the BUDDY SDK.

separator

 

Unity-Download-Assistant1

1 – Installation of Unity3D version 5.x

Go to the following url : http://unity3d.com/get-unity/download?ref=personal and download the most recent Windows installer.

Run the installer (UnityDownloadAssistant-5.x.x) which you had just downloaded. The installer will present the installation options you can choose and wish to install for Unity.

In order to achieve the goals for this tutorial, you must check, at a minimum, each of the following options:

  • Unity 5.x.x
  • Documentation (Not mandatory, but highly recommended)
  • Web Player
  • Standard Assets
  • Microsoft Visual Studio Community… (if not already installed on your computer)
  • Windows Build Support (to test your App on your PC via an emulator)
  • Android Build Support (needed as we are creating an Android build !)

separator

 

JDK2

2 – Installation of Java Developper Kit (JDK)

You should check if Blue Frog requires a minimal JDK version for the Buddy SDK. If that’s the case, make sure you download that version at a minimum. The Java Developper Kit (JDK) is available from this address from Oracle Corporation : http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Download and install it.

separator

 

INST-Androidstudio1

3 – Installation of Android Studio Bundle

Use the following url to downloiad Android Studio : https://developer.android.com/studio/index.html

Then, follow the recommended installation procedure.

separator

 

SDK-Sphero2

4 – Installation of the robot SDK

For our tutorial, we have downloaded the Sphero robot SDK from the following url : https://github.com/orbotix/Sphero-Android-SDK (for Buddy SDK, Blue Frog will provide downloading instructions soon).

separator

 

Android-Studio-01

5 – Configuration of Android Studio

Now that Android Studio has been installed, it is time to create and configure our first project in Android Studio.
Run Android Studio and create your first project:

separator

Android-Studio-02

Choose the minimum Android version for your application :

separator

Android-Studio-03

Choose the ‘activity type’ which corresponds the best to what your application will be used for :

separator

Android-Studio-04

At this point, you now have an Android Studio project created and ready to go :

separator

Android-Studio-05

We now have to manually copy some of the Robot SDK files into the Android studio project folder:
With Windows Explorer, go to yout « RobotLibrarySDK » folder; copy the file « RobotLibrary.jar » in your newly created Android Studio project folder named « libs »:

separator

Android-Studio-06

Now, add a dependancy for your « libs » folder :

  • Within your project folder structure, find the location of a file called “build.gradle”. There may be more than one file with the same name. Edit its content:
  • Under the section called “dependencies”, add the following line (note : it may already exist) :
compile fileTree(dir: 'libs', include: ['*.jar'])

separator

Android-Studio-07

If your application makes use of Bluetooth, you must add Bluetooth permissions for the project file named « AndroidManifest.xml » (Details found here: http://stackoverflow.com/questions/3400245/how-to-set-permissions-for-android-bluetooth)

Note : in addition, you must also include the following line in « AndroidManifest.xml” :

<uses-permission android:name="android.permission.INTERNET" />

separator

 

6 – Installation of Sphero Plugin for Unity

SpheroPluginUnity

Download the file “UNITY-PLUGIN-master.zip” from url: https://github.com/orbotix/UNITY-PLUGIN Then, unzip its content.
Next, create a new project in Unity.
From Unity and within your project itself, Import the newly unzipped plugin.
Make sure to read the read.me file provided with the SDK.
At this point, create your Unity Scenes as instructed from the Read.me or instructions provided with the SDK.

separator

Android-SDK

7 – Download and Install Standalone Android SDK Tools

Note : while performing step 3 of this tutorial « Installation of Android Studio Bundle » , you may have already installed the Android SDK tool, so this step may be skipped: Go to https://developer.android.com/studio/index.html#downloads Choose « Stand-Alone SDK Tools »
Complete the installation.

separator

8 – Create your first Android Build

Back in Unity, you will now attempt to create your Android Build executable.

You may receive a message which asks the location of the SDK. Upon specifying the answer, Unity might reject the information (you won’t be able to save and close the form). If this is the case, please follow the instructions at that url: Source: http://forum.unity3d.com/threads/select-android-sdk-root-folder.128725/

  • Launch Android Studio
  • In Android Studio, click on SDK Manager  from the toolbar.
  • Now, go in Unity and edit the preferences (Edit -> Preferences -> External tools -> Android SDK Location) and specify the path as: C:\Users\administrator\AppData\Local\Android\sdk

Build1

NOTE: the path listed above may be different on your computer, so please locate the folder using Windows Explorer first.

In Unity, it is possible you receive the following error message : « Bundle identifier has not been setup properly »

separator

Build2

If that happens, your next step is to adjust player parameters in Unity.
Go under: > Edit -> Project Settings -> Player
Player parameters show up at the bottom right corner on the screen (as illustrated above) :
Bundle Identifier :
Minimum API Level :

Note : make sure your «Minimum API Level » is in synch with the minimum Android version you had chosen during the Android Studio install.

separator

Build3

At this point, you should have been successful creating your Android Build !
In order to prove it, try to locate your .apk file. The .apk file is the executable code for your Android device.
Here is an example :
For more information, read the information at that url: http://docs.unity3d.com/Manual/android-BuildProcess.html)

separator

Final Step : run your application on your Android device.

separator

Build41. First, you must enable the « developer » option on your device :

On your device, go to : > About Phone > Build Number
Then, click 7 times in a row on the ‘build number’ displayed.
After clicking 7 times in a row, you should receive a confirmation “You are now a developer”
Connect the Android device to the computer where the .apk file was built. Use a usb cable.

separator

Build52. Install the « driver » which will allow you to move the .apk file from your computer to the Android device.
Go to the Google web site in order to download the « Google USB driver » using the following url : developer.android.com/sdk/win-usb.html

separator

Build63. Install the Google USB driver :
On your PC desktop, rightclick the “Computer” icon and choose “Properties”. On the window for the left column, choose “Device Manager”. Find your Android device under « Portable Devices » and then, assign the driver to the device.
separator

4. Make sure the Android device is connected and recognized by your computer ::

Start a terminal session where you get the « Command Prompt »
Go to the directory where the SDK is installed (for exemple: C:\users\username\AppData\Local\Android\sdk )

Go one level deeper under the subdirectory called « platform-tools »
Type and execute the following command: adb devices
If your device shows up, then it means it is attached and recognized by your computer (example below):

Build7

separator
Build85. Back in Unity, execute a « Build and Run »

Go to: > File > Build and Run
Choose Android
In section « Build Settings » under « Scenes in Build », make sure all your scenes appear in the right order. If they are not in the right order you can move them around with your mouse.
Execute the « Build and Run »
At the end of the process, Unity takes .apk file and moves it automatically to your Android Device.

Done !

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

X

En continuant à utiliser le site, vous acceptez l’utilisation des cookies. Plus d’informations

Les paramètres des cookies sur ce site sont définis sur « accepter les cookies » pour vous offrir la meilleure expérience de navigation possible. Si vous continuez à utiliser ce site sans changer vos paramètres de cookies ou si vous cliquez sur "Accepter" ci-dessous, vous consentez à cela.

Fermer