Home > Blockchain >  Gradle can't download dependencies with uppercase letters
Gradle can't download dependencies with uppercase letters

Time:12-06

When I try to build my app I am getting the following error:

> Could not resolve com.github.Raizlabs.DBFlow:dbflow-processor:4.0.5.
     Required by:
         project :ExampleApp
      > Could not resolve com.github.Raizlabs.DBFlow:dbflow-processor:4.0.5.
         > inconsistent module metadata found. Descriptor: com.github.raizlabs.dbflow:dbflow-processor:4.0.5 Errors: bad group: expected='com.github.Raizlabs.DBFlow' found='com.github.raizlabs.dbflow'

my gradle dependencies:

def dbflow_version = "4.0.5"

dependencies {

    implementation "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
    implementation "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
    kapt "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
    implementation "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${dbflow_version}"
}

Android Gradle Plugin Version: 7.0.2

I actually found a solution, which is using just lower cases, like this:

def dbflow_version = "4.0.5"

dependencies {

    implementation "com.github.raizlabs.dbflow:dbflow:${dbflow_version}"
    implementation "com.github.raizlabs.dbflow:dbflow-core:${dbflow_version}"
    kapt "com.github.raizlabs.dbflow:dbflow-processor:${dbflow_version}"
    implementation "com.github.raizlabs.dbflow:dbflow-kotlinextensions:${dbflow_version}"
}

and this works, but my question is why can't gradle find this ? my colleagues have the dependencies with upper cases and it works for them. The only thing I changed is recently I updated Android Studio to Android Studio Dolphin | 2021.3.1 Patch 1

CodePudding user response:

Perhaps you are on unix and your colleagues are on windows? Unix filesystem is case sensitive whereas windows filesystem is not so could be related to that.

Either way it's best to use the correct case as specified by the provider of the dependency when declaring your dependencies. Gradle will use the provided group/artifact/version to calculate a URL for the dependency. If the URL has the wrong case a server could (in theory) respond with 404 where the case is incorrect.

Gradle will also use the group/artifact/version to build a cache key for artifacts. If you have the incorrect case this could cause cache misses. I wonder if the cache key calculation changed between gradle versions and went from being case insensitive to case sensitive.

CodePudding user response:

Gradle is case-insensitive when resolving dependencies, so it should not matter if a dependency has uppercase letters in its name. If you are unable to download a dependency with uppercase letters in its name, there may be a different issue at play.

One potential issue is a typo in the dependency name. Make sure that you have spelled the dependency name correctly in your build.gradle file.

Another potential issue is a problem with the repository where the dependency is hosted. Check the repository's configuration in your build.gradle file and ensure that it is correct and that it is accessible from your machine.

Finally, if the dependency is hosted on a remote server, check to see if the server is accessible and if the dependency is available on the server. You can use a tool like wget or curl to download the dependency directly from the server and verify that it exists.

If you are still unable to download the dependency with uppercase letters in its name, you may need to contact the repository maintainer or the dependency's author for further assistance

  • Related