Search code examples
androidkotlinandroid-studiogradle

Gradle doesn’t download some certain dependency


I built a new PC and am trying to build a specific project on it, but despite the sync being successful, it does not build and does not open the app. It tries to download certain dependencies, but gives an error. I formatted another PC and tried to install it, but it gave the same error. On my work laptop, the project runs normally, as well as on my coworkers' machines, which shows that it is not a problem with the code, Maven or any other dependency.

I've already tried deleting gradle and downloading it again, as well as gradlew clean build --refresh-dependencies. I've already tried to clone the project again.

Any suggestions?

 ./gradlew clean build --refresh-dependencies --stacktrace

> Configure project :app

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileVitoriaReleaseKotlin'.
> Could not resolve all files for configuration ':app:homologDebugRuntimeClasspath'.
   > Could not find com.google.android:flexbox:2.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/flexbox/2.0.0/flexbox-2.0.0.pom
       - 
     Required by:
         project :app > project :
         project :app > project :

   > Could not find com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5.
     Searched in the following locations:
       -
       - 
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko-commons:0.10.8.
     Searched in the following locations:
       -
 
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko-design:0.10.8.
     Searched in the following locations:
       -
    
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko:0.10.8.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/anko/anko/0.10.8/anko-0.10.8.pom
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko-appcompat-v7:0.10.8.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/anko/anko-appcompat-v7/0.10.8/anko-appcompat-v7-0.10.8.pom
       
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko-coroutines:0.10.8.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/anko/anko-coroutines/0.10.8/anko-coroutines-0.10.8.pom
       
     Required by:
         project :app > project :
   > Could not find org.jetbrains.anko:anko-appcompat-v7-coroutines:0.10.8.
     Searched in the following locations:
       
    
     Required by:
         project :app > project :
   > Could not find com.jackandphantom.android:blurimage:1.2.0.
     Searched in the following locations:
     
     Required by:
         project :app > project :

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

BUILD FAILED in 2m 8s

Solution

  • On my work laptop, the project runs normally, as well as on my coworkers' machines, which shows that it is not a problem with the code, Maven or any other dependency.

    No, it shows that the dependencies in question are cached by Gradle on those machines.

    You and your co-workers are several years out of date with respect to dependencies, and your Gradle configuration does not support the obsolete dependencies that you are trying to use. At minimum, you will need to find the Gradle repositories that house these out-of-date dependencies and add them to your Gradle configuration. Better would be to replace the dependencies with currently-maintained ones.

    Let's look at the first one: com.google.android:flexbox:2.0.0. If you examine https://maven.google.com, you will find that there is no such dependency. If you search the Maven repository index for com.google.android:flexbox, you will learn a few things:

    1. com.google.android:flexbox:2.0.0 was released in 2019, five years ago. Please aim to use newer artifacts.

    2. com.google.android:flexbox:2.0.0 was published on a short-lived Google instance at Bintray, which has long since been abandoned.

    3. The Maven coordinates moved, and the now-current version of Flexbox is at com.google.android.flexbox:flexbox:3.0.0, and is hosted in Google's Maven repository (google() in a Gradle repository configuration).

    So, you should focus on either moving to com.google.android.flexbox:flexbox:3.0.0 or eliminating Flexbox.

    You will need to do similar analyses for the others:

    • Search for them in the Maven repository index

    • Use that information to determine what to change (adding some missing repository, updating to a newer artifact version, replacing the dependency with something else, etc.)