Skip to main content
VESDK/Android/Concepts

IMG.LY Gradle Plugin

This is the enhanced IMG.LY Gradle Plugin Documentation. Learn how to configure the SDK using our plugin for special project structures.

This document offers an in-depth guide on integrating and utilizing the IMG.LY Gradle Plugin for Android projects, focusing on leveraging the full capabilities of the PhotoEditor SDK. It incorporates insights from the plugin code to clarify configuration options, module management, and advanced usage scenarios.

Introduction#

The IMG.LY Gradle Plugin simplifies adding the PhotoEditor SDK into Android applications, providing a wide range of photo editing functionalities. Detailed below are the steps for adding the plugin, configuring the SDK, and understanding the nuanced use of IMGLY.predefine and IMGLY.configure methods.

Setup and Configuration#

Adding IMG.LY Repository#

Firstly, include the IMG.LY Maven repository in your settings.gradle file to access the SDK packages:

pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
}
}

Applying the Plugin#

In your module's build.gradle, apply the IMG.LY, Kotlin, and KSP plugins:

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'ly.img.android.sdk' version 'X.X.X' // Use the latest version
id 'com.google.devtools.ksp' version 'Y.Y.Y' // Match with your Kotlin version
}

Configuring the SDK with IMGLY.configure#

Use IMGLY.configure to finalize your SDK setup. This method locks the configuration, making subsequent changes impossible:

IMGLY.configure {
pesdk {
enabled true
licensePath 'pesdk_license'
}
modules {
// List all desired SDK modules here
}
}

Initial Setup with IMGLY.predefine (Optional)#

If needed IMGLY.predefine allows for initial, modifiable configurations. IMGLY.predefine can be invoked multiple times for different product flavors or build conditions, allowing a granular approach to SDK configuration. To finalize the configuration you need to call IMGLY.configure().

IMGLY.predefine {
pesdk {
enabled(true)
licensePath(null) // Adjust as necessary
}
// Include preliminary modules
}

Advanced Configuration Options#

Module Management#

Modules dictate the features available in your SDK. The modules block within IMGLY.configure or IMGLY.predefine allows including or excluding specific features:

modules {
include 'ui:filter'
// Exclude or include additional modules as needed
}

Skipping Plugin Check#

In cases where automatic plugin application issues arise, skipPluginCheck can bypass plugin configuration checks:

IMGLY.predefine {
skipPluginCheck = true
}

Understanding the Plugin Code#

The plugin code provides mechanisms for detailed SDK customization, including setting the SDK version, managing license paths, and configuring dependency inheritance. It supports both PE.SDK and VE.SDK configurations, offering versatility in photo and video editing capabilities.

Finalizing Configuration#

After setting up with IMGLY.predefine, finalize your configuration with a final configuration block IMGLY.configure {} or by invoke IMGLY.configure(). This step is crucial for applying your setup and preparing your project for building.

Conclusion#

The IMG.LY Gradle Plugin offers a powerful yet flexible framework for integrating photo editing features into Android apps. By understanding and utilizing IMGLY.predefine and IMGLY.configure, developers can tailor the SDK to fit their application's specific needs, ensuring a seamless user experience.