Hong
Hong

Reputation: 18531

Error "Could not resolve all files for configuration ':app:debugRuntimeClasspath'" with custom repository

My goal is to use an aar in this repository.

In the project build.gradle:

buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://raw.github.com/saki4510t/libcommon/master/repository/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

The app module's build gradle:

implementation("com.serenegiant:common:4.1.1") {
    exclude module: 'support-v4'
}

The above actually works in a project. However, in another project, I keep getting the following error:

Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.serenegiant:common:4.1.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/serenegiant/common/4.1.1/common-4.1.1.pom
       - https://repo.maven.apache.org/maven2/com/serenegiant/common/4.1.1/common-4.1.1.pom
       - https://jitpack.io/com/serenegiant/common/4.1.1/common-4.1.1.pom
     Required by:
         project :app

I am really puzzled. I cannot tell what difference between these two project results in this. I may be missing something very simple. Could anyone offer a tip on this?

I have rebuilt the project many times and invalided caches and restarted Android Studio many times to no avail.

Update [2023-05-23]

Following a tip, I ran ./gradlew --info --refresh-dependencies but got the following for the working project:

> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:7.4.2.
     Required by:
         project :
      > No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a lib
rary compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')

Update [2023-05-24]

Here is something making this even more mysterious: if I change "com.serenegiant:common:4.1.1" to "com.serenegiant:common:2.1.1", Android Studio warns me a newer version is available. This means it knows dependency well enough to tell which version is the latest, and yet cannot fetch it.

Upvotes: 0

Views: 3087

Answers (0)

Related Questions