How to Add a Package with Gradle

How to Add a Package with Gradle

Integrating a new library into your Android project is straightforward using Gradle, the default build tool for Android Studio. Here's how to do it:

1. Open Your Android Project

Launch Android Studio and open the project where you want to add the new dependency.

2. Locate build.gradle

Navigate to the app/build.gradle file, which defines dependencies for your app module.

3. Add the Dependency

Within the dependencies block, insert the library you want to use. Typically, you can find this on the SDK's website or GitHub README.

dependencies {
    // other dependencies
    implementation("com.github.nonanerz:sddl-android-sdk:1.1.1")
}

4. Sync Gradle Files

After editing build.gradle, Android Studio should prompt you to sync. Click "Sync Now" or press the "Sync Project with Gradle Files" button in the toolbar.

5. Verify the Integration

Once syncing is complete, check the External Libraries in Android Studio to confirm the SDK is downloaded and recognized.

6. Start Using the SDK

Import the classes from the SDK in your code and begin using its features.