---
title: "Adding HUD APIs, Resource, and Project Cleanup"
slug: "adding-hud-apis-resource-and-project-cleanup-1"
updated: 2024-09-05T14:24:44Z
published: 2024-09-05T14:24:44Z
canonical: "support.vuzix.com/adding-hud-apis-resource-and-project-cleanup-1"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.vuzix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding HUD APIs, Resource, and Project Cleanup

## **Configure build.gradle**

Android projects have multiple build.gradle files. These files provide the compiler with compile-time information about the project. This information includes how to compile, what dependency libraries are used, where to get them, and which Android versions the application will support in addition to other application information.

For this example, it is important to configure the build.gradle file for the main app module. Please be sure to modify the correct file as shown below. Open the **build.grade (Module: app)**, not the **build.gradle (Project: BladeSampleApp)** file. The screen below shows an unmodified version of the build.gradle file generated by Android Studio. There is some additional information here that we will remove shortly.

​

[![](https://vuzix.intercom-attachments-1.com/i/o/459769861/8120eb99ed0e41ad5fb9cee0/_Gradle_Default_20180601184719985.png)](https://vuzix.intercom-attachments-1.com/i/o/459769861/8120eb99ed0e41ad5fb9cee0/_Gradle_Default_20180601184719985.png)

Default build.gradle

For simplicity of this example application, remove the **testInstrumentationRunner** line from the **defaultConfig** section. ​

And replace all of the dependencies in the **dependencies** section with simply **implementation 'com.vuzix:hud-actionmenu:1.3' and implementation 'com.vuzix:hud-resources:1.2'**. This dependency allows the Blade application to use dynamic theme and other Blade specific features. [Refer to Dynamic Theme section for more information.](/v1/docs/dynamic-light-and-dark-theme-1)

***Note: Anytime this file is modified, Android Studio will display a warning stating that the files have changed, and a project sync should be performed. We will do a project sync after making other changes as well.*** ​

Before we can sync the project, let’s change the layout of the main activity as described in the next section.

​

[![](https://vuzix.intercom-attachments-1.com/i/o/459769870/14cefe5338dfd639c8710f75/_SampleApp3_20190514154546526.PNG)](https://vuzix.intercom-attachments-1.com/i/o/459769870/14cefe5338dfd639c8710f75/_SampleApp3_20190514154546526.PNG)

Modified build.gradle

​

## **Change Default Activity Layout**

By default, Android Studio will generate activities using a Constraint layout. For simplicity, this example uses the Relative layout.

Open the **activity_main.xml** layout (\res\layout\activity_main.xml).

The Layout will open on the "Design" Tab. ​

**We recommend that you change your Default Device via the Device Editor to be the Vuzix Blade. If you have not created a**[**device profile**](/v1/docs/creating-a-device-profile-2)**for the Blade in Android Studio, we strongly recommend you do so now to aid in the development of UI elements.**

​

Notice the **ConstraintLayout** class is used as the main Layout Element.

​

Change the Layout to now be a **RelativeLayout**.

For more information on the Android Layouts or the ConstraintLayout class see the Android documentation:

- [https://developer.android.com/guide/topics/ui/declaring-layout](https://developer.android.com/guide/topics/ui/declaring-layout).
- [https://developer.android.com/reference/android/support/constraint/ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout).

​

To further simplify the layout, you can modify the following:

- Remove the "**xmlns:app="http://schemas.android.com/apk/res-auto**" from the Top RelativeLayout definition.
- Remove the constraint attributes (app:layout_constraintTop_toTopOf=”parent”, for instance) from the TextView element. ​

​

Note: The constraint layout requires a dependency. We removed that dependency when we modified the generated gradle.build file above. ​

​

[![](https://vuzix.intercom-attachments-1.com/i/o/459769874/79c290f2fb7d4721fb8bc345/_default_layout_20180601184720141.png)](https://vuzix.intercom-attachments-1.com/i/o/459769874/79c290f2fb7d4721fb8bc345/_default_layout_20180601184720141.png)

Constraint Layout

[![](https://vuzix.intercom-attachments-1.com/i/o/459769879/7479d83f91fde4bc2281889e/_default_layout_mod_20180601184720235.png)](https://vuzix.intercom-attachments-1.com/i/o/459769879/7479d83f91fde4bc2281889e/_default_layout_mod_20180601184720235.png)

Relative Layout ​

## **Sync the project**

Now that we have modified the build.gradle file and simplified our activity layout, we are ready to sync the project. ​

Open the build.gradle file again and click on the **Sync now** link. ​

Android Studio will refresh the project using the modified build.gradle file and build the project.

If the build.gradle file and layout file are correct, the Build should complete successfully as shown below.

​

[![](https://vuzix.intercom-attachments-1.com/i/o/459769887/7e3a082e9946236fcaed3b41/_SampleAppActivity2_20190514154546620.PNG)](https://vuzix.intercom-attachments-1.com/i/o/459769887/7e3a082e9946236fcaed3b41/_SampleAppActivity2_20190514154546620.PNG)

​

Once the project has built successfully, the Blade-specific libraries can be inspected in the Project window. ​

Change the project view from the **Android** view to the **Project** view in the top left of the file explorer.

Expand the**External Libraries** section to explore the**hud-actionmenu** and **hud-resources**classes.

​

[![](https://vuzix.intercom-attachments-1.com/i/o/459769892/09a05722072bf429267c5089/_JavaDocs2_20190514154546698.PNG)](https://vuzix.intercom-attachments-1.com/i/o/459769892/09a05722072bf429267c5089/_JavaDocs2_20190514154546698.PNG)

hud-resources expanded

​

We now have all the Vuzix HUD resource and libraries. ​

These libraries will provide a lot of resources that will help you as a developer to build more intuitive apps with performance dedicated to the Vuzix Blade.

To learn more about these libraries, you can download the independent JavaDocs or read our section on them.

- JavaDocs

  - For the HUD Resource Package: [HUD-Resources Java Docs](https://vuzix.github.io/hud-resources/javadoc/com/vuzix/hud/resources/package-summary.html) ​
  - For the HUD ActionMenu Package: [HUD-ActionMenu Java Docs](https://vuzix.github.io/hud-actionmenu/javadoc/com/vuzix/hud/actionmenu/package-summary.html)
