In addition to the Android Developer Tools (ADT) plug-in for Eclipse / Android SDK, you can also use Android Studio (a new Android development environment based on IntelliJ IDEA) for developing and porting apps using Nokia X services SDK.
Download and install the latest version of Android Studio from the Android Studio web page. Note that Android Studio requires the latest version of Java Development Kit (JDK) to function (JRE alone is not sufficient). Make sure that the bit version of the bundle matches the JDK, that is, both need to be either 32-bit or 64-bit.
Note: Nokia X services SDK is tested on Android Studio v0.4.6 (early access preview).
Installing the required tools and packages
Open Android Studio. The Android Studio welcome page appears.
In the Android Studio welcome page, create a new project or open an existing project using the default settings. This launches the Project view for your project in Android Studio.
Note: The welcome page does not always appear. In that case, click the File menu to create or open a project.
From the Tools menu, select Android > SDK Manager. The Android SDK Manager dialog appears.
From the Android SDK Manager, ensure that the following Android SDK and tools are installed:
Close Android SDK Manager and Android Studio to install the Nokia X services SDK.
See the Install Nokia X specific packages section on Environment setup page for instructions on how to install the SDK add-ons.
To check whether the installation was successful, open the Android SDK Manager as shown below and ensure that the following packages are installed:
Open Android Studio.
Select Configure > Project Defaults > Project Structure.
If your project is already open, from the File menu, select Project Structure. For default project settings, select File > Other Settings > Default Project Structure. The Project Structure dialog appears.
Under Platform Settings, select SDKs and click Add New SDK (+ symbol) > Android SDK.
The Select Home Directory for Android SDK dialog appears.
Select the path in which Nokia X services SDK is installed as shown above and click OK. The default path is <androidstudio-install-path>\sdk. The Create New Android SDK dialog appears.
Under Build Target, for Nokia X2, select Nokia X software platform 2.0 (4.3) and for Nokia X/X+/XL, select Nokia X software platform 1.1 (4.1.2). Once you are done click OK.
The selected build target is added to the SDKs list. Now your projects are ready to build using Nokia X software platform.
Click OK to complete the configuration.
Nokia X code samples plug-in helps you to easily load and run Nokia X code samples onto the Android Studio project workspace.
Perform the following steps to install the Nokia X code samples plug-in:
On Android Studio, from the File menu, click Settings or click the Settings icon as shown below.
The Settings dialog appears. Select Plugins from the left pane.
Click Browse repositories. The Browse Repositories dialog appears.
Click Manage repositories. The Custom Plugin Repositories dialog appears.
Click Add (or the plus symbol) to add a new custom plug-in repository from which you can download and install the Nokia X code samples plug-in. The Add Repository dialog appears.
Specify the following plug-in download URL in the Repository URL field and click OK:
The plug-in download URL you specified is added to the Custom Plugin Repositories dialog.
Click OK to return to the Browse repositories dialog.
From the Repository drop-down list, select the following plug-in download URL you added earlier as shown below.
The Nokia X Code samples plug-in is loaded in the left pane and is available for download and install as shown below:
Select Nokia_X_Code_Samples from the list and click the Download and Install icon to proceed with the installation.
A prompt appears requesting whether you want to proceed with the installation.
Click Yes to proceed with the download and installation of the Nokia X code samples plug-in.
Once the plug-in download is complete, text Downloaded is added next to the Nokia_X_Code_Samples in the Browse repositories dialog as shown below.
Click Close to return to the Settings dialog. Now you can see the Nokia X code samples plug-in added to the Settings dialog.
In the Settings dialog, click OK to complete the installation.
Once the plug-in installation is complete, you will be prompted to restart Android Studio to activate the plug-in.
Click Restart to restart Android Studio and complete the plug-in installation.
After installing Nokia X code samples plug-in on Android Studio, you can load them onto the Android Studio project workspace by performing the following steps:
In Android Studio, from the Nokia menu, select Code Samples or click the Code Samples icon as shown below.
The Code Samples dialog is displayed.
Select a sample from the Examples list (for example, NIAP - PepperFarmSimulator) and click Open to load the sample onto the Android Studio project workspace. The sample is loaded onto the Project view.
Important: If you are loading one of the OneAPK samples, ensure that you have installed the following packages using Android Studio - SDK Manager and you sync your project with gradle files by clicking the Sync Project with Gradle files icon in Android Studio:
This topic provides solutions for common problems that you may encounter while using the SDK tools that are part of the Nokia X services SDK.
Gradle project sync fails on Android Studio
Problem: When you try to load a Nokia X code sample project on Android Studio you get an error message: "Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly."
In the Settings dialog, select Projects Settings > Gradle and add the following arguments under Gradle VM options (figure 28):
Click the Sync project with Gradle files icon as shown below to perform a sync (figure 29).
Last updated 25 June 2014