0

I need to add android dependencies manually to gradle caches directory, as the gradle build can not get it but I can download it from my browser. This is the error:

> Could not find aapt2-7.0.4-7396180-osx.jar (com.android.tools.build:aapt2:7.0.4-7396180).
    Searched in the following locations:
        https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/7.0.4-7396180/aapt2-7.0.4-7396180-osx.jar

I manually downloaded aapt2-7.0.4-7396180-osx.jar file and put it in the following directory:

username/.gradle/caches/modules-2/files-2.1/com.android.tools.build/aapt2/7.0.4-7396180/18ae77ce0ff3ba9da85e4674c2c92751cd1dc973/

I found the directory name: "18ae77ce0ff3ba9da85e4674c2c92751cd1dc973" from this command:

shasum aapt2-7.0.4-7396180-osx.jar

After this, I run the gradle build again, But I got the same error again and the build process tries to download the library and did not noticed that I have already downloaded it. Should I do anything else to let the build process know that this file is already downloaded?

Payam Roozbahani
  • 1,225
  • 15
  • 27
  • ist this a duplicate of [stackoverflow: how-to-add-local-jar-file-dependency-to-build-gradle-file](https://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file)? – k3b Feb 08 '23 at 09:57

1 Answers1

0
  1. If this is not your case.

  2. Should I do anything else to let the build process know that this file is already downloaded?

    Try in your build.gradle append explicitly path to lib. For me it's look like this:

    Path to:

    AndroidStudioProjects/DiceRoller/app/build.gradle
    

    Source:

    dependencies {
            ...
            implementation files("~/Downloads/aapt2-7.0.4-7396180-osx.jar")
        }
    

    Run:

    gradle clean
    
  • I want to add this library to gradle caches. I found that I should modify the binary files in username/.gradle/caches/modules-2/metadata-2.XX as well. But I don't know how yet. – Payam Roozbahani Feb 21 '23 at 08:51