Skip to content

Installation

Alain Pimentel edited this page Aug 25, 2020 · 9 revisions

There are various ways this library can be installed and used by developers.

Include library as dependency

If you wish to just use this library without making any modifications to the source code, you can use jitpack.io to directly add the dependency to your application using the following steps.

  1. Add the following at the end of your root build.gradle under "repositories" -
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency to your application's build.gradle file with the version you want -
dependencies {
  ...
  implementation 'com.github.dji-sdk:Mobile-UXSDK-Beta-Android:v0.4.0'
}
  1. Ensure your app-level build.gradle file includes the packagingOptions, dexOptions, compileOptions and MSDK dependencies as specified here.

More information from jitpack.io on how this can be done here.

Include library as a local module

  1. Clone the library using git or download it, and open it in Android Studio.
  2. Modify the source code if and as required.

Include the compiled AAR file

If you do not intend to modify the code very often and would like to keep your application's code clean, you can include the library as an AAR file. Since Beta 3, UX SDK has been split into various modules so you can pick and choose what you need. The modules wiki contains information on what each module provides.

  1. To build an AAR package with the UX SDK library, open a terminal and navigate to the git folder you have cloned the repository into - cd path/to/git/folder
  2. Navigate to the scripts folder inside the UX SDK repository
  3. Run the command python uxsdkCreateAAR.py. This will generate an AAR for each module in the same folder where the script ran.
  4. Once the scripts finishes, in your file manager navigate to the following folder - GitClonedFolder -> scripts -> android-uxsdk-beta. In this folder you will find an AAR for each UX SDK module that you can include in your project.
  5. To include the files, open your application in Android Studio. Go to File -> New -> New Module. Select Import .JAR/.AAR Package from the list and click next. Enter the location of the compiled AAR above and then click finish. Repeat this step for each of the modules you want to add to your application.
  6. Make sure the library is listed at the top of your settings.gradle file - e.g., include ':app', ':android-uxsdk-beta-core', ':android-uxsdk-beta-cameracore' and so on for any other module you need for your application.
  7. Open your app module's build.gradle file and add the following to the dependencies block - implementation project(":android-uxsdk-beta-core"). Similarly, add any other UX SDK modules you want for your application.
  8. Click Sync Project with Gradle Files.

Include library code as a module

If you intend to make regular changes to the source code, you can directly include the UX SDK library as a module in your application.

  1. Open your application in Android Studio and click File -> New -> Import Module.
  2. Enter the location of the module, e.g., for core that is android-uxsdk-beta-core folder and click finish. This copies the library module to your project so you can edit the code as you need.
  3. Make sure the library is listed at the top of your settings.gradle file - include ':app', ':android-uxsdk-beta-core'.
  4. Open the app module's build.gradle file and add the following to the dependencies block - implementation project(":android-uxsdk-beta-core"). Repeat this process for other UX SDK modules you want for your application.
  5. Click Sync Project with Gradle Files.

More information on how this can be done using Android Studio can be found here and here.

Clone this wiki locally