'Can't import any library to Android Studio and Gradle Failed to Resolve

I have tried these two libraries in order to make Image Zoomable, but I'm facing the same problem. This is the error message

Failed to resolve: com.github.MikeOrtiz:TouchImageView:1.4.1 Show in Project Structure dialog Affected Modules: app

At first, I thought it's maybe because of Jetpack Compose with Java, Because I tried to use TouchImageView Library as I've mentioned here,

implementation 'com.github.MikeOrtiz:TouchImageView:1.4.1'

for this Library, it was needed to import

maven { url 'https://jitpack.io' }

I did import it to build.gradle project, also there was no allproject in that file, then I tried to import it into settings.gradle as well. in short, I just faced the same error message image is shown below

Gradle Warning/error message image



Solution 1:[1]

Go to settings.gradle

Add this line at bottom: include ':app',':touchview'

Add maven { url 'https://jitpack.io' } to

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories           

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 richardec