androidmacosandroid-studiobuild.gradle

Error building Android project on Mac M2: "Could not find com.commit451:PhotoView:1.2.4"


I am facing an issue when trying to build my Android project on a Mac M2. The project was working fine both on my Mac and on a Linux environment, but after an update (possibly to macOS or Android Studio), the build started failing. The error I am receiving is:

> Task :app:writeMeuProjetoDebugSigningConfigVersions

FAILURE: Build completed with 8 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkMeuProjetoDebugAarMetadata'.
> Could not resolve all files for configuration ':app:meuProjetoDebugRuntimeClasspath'.
   > Could not find com.commit451:PhotoView:1.2.4.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://jcenter.bintray.com/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://repo.maven.apache.org/maven2/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://maven.google.com/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://jitpack.io/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://oss.sonatype.org/content/repositories/snapshots/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
       - https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1/com/commit451/PhotoView/1.2.4/PhotoView-1.2.4.pom
     Required by:
         project :app

What I have tried:

Current setup: Mac M2 running macOS 15.0.1. Android Studio Ladybug Feature Drop | 2024.2.2 Canary gradle:7.4.2 openjdk 17.0.9 2023-10-17

Question: Has anyone encountered this issue or has any idea how to resolve it? Multiple dependencies, including com.commit451:PhotoView:1.2.4, seem to be missing from the configured repositories, but the project used to build without issues.


Solution

  • Has anyone encountered this issue or has any idea how to resolve it?

    That particular library (com.commit451:PhotoView) has not been updated in six years. It is no longer published in major artifact repositories, probably due to the JCenter wind-down a couple of months ago.

    The reason you are encountering a problem now is that your local Gradle cache does not contain that artifact, whereas perhaps it did before.

    The best solution is migrate to something newer and actively maintained. There are lots of pinch-zoom libraries out there.

    Apparently, that library has a couple of versions hosted at "Spring Lib M", so as a stopgap, you could configure to pull artifacts from there. However, I would not recommend that as a long-term solution.

    Multiple dependencies, including com.commit451:PhotoView:1.2.4, seem to be missing from the configured repositories, but the project used to build without issues.

    All of those might have been published on JCenter and not updated in years.