Skip to content

Downgrade AGP to 4.1.3

This guide explains how to downgrade Android Gradle Plugin (AGP) from 8.5.1 to 4.1.3 when using the uiextensions_src source project.

Background

Since SDK v9.1, to better support 16 KB page size devices, AGP was upgraded from 4.1.3 to 8.5.1, and Android Studio Koala | 2024.1.1 or later is required.

If you prefer not to upgrade AGP or Android Studio and integrate via uiextensions_src, follow the steps below in the uiextensions_src project.

Steps (uiextensions_src Project)

1) Downgrade AGP to 4.1.3 in build.gradle

kotlin
dependencies {
    classpath 'com.android.tools.build:gradle:4.1.3'
    // classpath 'com.android.tools.build:gradle:8.5.1'
}

2) Downgrade Gradle to 6.7 in gradle-wrapper.properties

properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
# distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

3) (Optional) Remove namespace and adjust compileSdk / minSdk / targetSdk

kotlin
android {
    // namespace 'com.foxit.uiextensions'
    compileSdk 33

    defaultConfig {
        minSdk 19
        targetSdk 33
        versionCode 29
        versionName "9.1.0"
        consumerProguardFiles 'proguard-rules.pro'
    }

    // ...
}

4) Adjust some dependency versions

kotlin
dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'

    // implementation 'androidx.appcompat:appcompat:1.7.0'
    // implementation 'com.google.android.material:material:1.12.0'
    // ...
}

5) Use JDK below version 17

For example JDK 11 or JDK 8.