Gradle keeps re-downloading android sdk resources

Viewed 527

I am using Visual Studio Code for Android Dev running on Ubuntu (18)

gradle version: 7.4.2
java jre: 11 and 8
I have downloaded Android SDK with:
    "platforms;android-29"
    "platforma;android-31"
    "build-tools;29.0.0"

Every time I the command:

./gradlew assembleRelease

I get:

License for package SDK Patch Applier v4 accepted.
Preparing "Install SDK Patch Applier v4 (revision: 1)".
Warning: Package "com.android.repository.impl.generated.v2.RemotePackage@b2d2115" (patcher;v4) should be installed in 
"/home/phoxett/cmdline-tools/patcher/v4" but 
it already exists.
Installing in "/home/phoxett/cmdline-tools/patcher/v4-5" instead.
"Install SDK Patch Applier v4 (revision: 1)" ready.
Installing SDK Patch Applier v4 in /home/phoxett/cmdline-tools/patcher/v4-5
"Install SDK Patch Applier v4 (revision: 1)" complete.
"Install SDK Patch Applier v4 (revision: 1)" finished.
Checking the license for package Android Emulator in /home/phoxett/cmdline-tools/licenses
License for package Android Emulator accepted.
Preparing "Install Android Emulator (revision: 31.2.10)".
"Install Android Emulator (revision: 31.2.10)" ready.
Installing Android Emulator in /home/phoxett/cmdline-tools/emulator
"Install Android Emulator (revision: 31.2.10)" complete.
"Install Android Emulator (revision: 31.2.10)" finished.
Checking the license for package Android SDK Platform-Tools in /home/phoxett/cmdline-tools/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 33.0.2)".
"Install Android SDK Platform-Tools (revision: 33.0.2)" ready.
Installing Android SDK Platform-Tools in /home/phoxett/cmdline-tools/platform-tools
"Install Android SDK Platform-Tools (revision: 33.0.2)" complete.
"Install Android SDK Platform-Tools (revision: 33.0.2)" finished.
Checking the license for package Android SDK Tools in /home/phoxett/cmdline-tools/licenses
License for package Android SDK Tools accepted.
Preparing "Install Android SDK Tools (revision: 26.1.1)".
Warning: Package "com.android.repository.impl.generated.v2.RemotePackage@f6eee083" (tools) should be installed in 
"/home/phoxett/cmdline-tools/tools" but 
it already exists.
Installing in "/home/phoxett/cmdline-tools/tools-4" instead.
"Install Android SDK Tools (revision: 26.1.1)" ready.
Installing Android SDK Tools in /home/phoxett/cmdline-tools/tools-4
"Install Android SDK Tools (revision: 26.1.1)" complete.
"Install Android SDK Tools (revision: 26.1.1)" finished.
Checking the license for package Android SDK Build-Tools 30.0.2 in /home/phoxett/cmdline-tools/licenses
License for package Android SDK Build-Tools 30.0.2 accepted.
Preparing "Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)".
Warning: Package "com.android.repository.impl.generated.v2.RemotePackage@9b08c1ac" (build-tools;30.0.2) should be installed in 
"/home/phoxett/cmdline-tools/build-tools/30.0.2" but 
it already exists.
Installing in "/home/phoxett/cmdline-tools/build-tools/30.0.2-4" instead.
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" ready.
Installing Android SDK Build-Tools 30.0.2 in /home/phoxett/cmdline-tools/build-tools/30.0.2-4
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" complete.
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" finished.
Checking the license for package Android SDK Platform 31 in /home/phoxett/cmdline-tools/licenses
License for package Android SDK Platform 31 accepted.
Preparing "Install Android SDK Platform 31 (revision: 1)".
Warning: Package "com.android.repository.impl.generated.v2.RemotePackage@ca55bbf4" (platforms;android-31) should be installed in 
"/home/phoxett/cmdline-tools/platforms/android-31" but 
it already exists.
Installing in "/home/phoxett/cmdline-tools/platforms/android-31-3" instead.
"Install Android SDK Platform 31 (revision: 1)" ready.
Installing Android SDK Platform 31 in /home/phoxett/cmdline-tools/platforms/android-31-3
"Install Android SDK Platform 31 (revision: 1)" complete.
"Install Android SDK Platform 31 (revision: 1)" finished.

if I keep running the command:

./gradlew assembleRelease

The following get re-downloading: platform-tools, tools, emulator, and patcher/v4

How do I stop gradle from re-downloading existing files

my build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.2"
    }
}


allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

Other build.gradle:

plugins {
    id 'com.android.application'
}

android {
    compileSdk 31
    defaultConfig {
        applicationId "xxx.xxx.xxx"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'io.socket:socket.io-client:1.0.0'
    implementation 'com.android.volley:volley:1.2.0'
}

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
0 Answers
Related