Build Your First App in Java
Last updated
Last updated
Open Android Studio.
In the Welcome to Android Studio dialog, click Start a new Android Studio project.
Select Basic Activity (not the default). Click Next.
Give your application a name.
Make sure the Language is set to Java(Development in Kotlin is supported but this guide will cover java development).
Make sure to set Minimum SDK Version” to “27”
Click Finish.
Main Activity is the run screen that a user will encounter when open your app. Navigate to activity_main.xml on the left pane.
This should open the layout manger.
Switch to visual layout mode.
Change the device to TV(720p) and the orientation to landscape.
Ensure that all other layouts are configured the same way.
Your application is now be ready to run on the X2 headset.
What you need:
A USB-C Cable to connect X2 to USB port on your computer.
If you are using a Linux or Windows OS, you may need to perform additional steps to run your app on X2 Check the Run Apps on a Hardware Device documentation. On Windows, you may need to install the appropriate USB driver for your device.
To let Android Studio communicate with your device, you must turn on USB Debugging on your Android device. By Default X2 has ADB(Android Debug Bridge) enabled.
If for some reason it is disable you can enable it by"
On your device, open Settings > About phone and tap Build number seven times.
Return to the previous screen (Settings). Developer options appears at the bottom of the list. Tap Developer options.
Enable USB Debugging.
Connect your device to your development machine with a USB cable. On the device, you might need to agree to allow USB debugging from your development device.
Select your device, and click OK. Android Studio installs the app on your device and runs it.
In Android Studio, click Run in the toolbar at the top of the window. The Select Deployment Target dialog opens with the list of available emulators and connected devices.