Home > database >  Gradle is not searching for packages in local Maven repository. How to fix?
Gradle is not searching for packages in local Maven repository. How to fix?

Time:12-15

Here is my root build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenLocal()
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.2"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

When I try to run ./gradlew :app:compileDebugKotlin I get this:

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.neborosoft.AndroidJniBridgeGenerator:annotations:1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/neborosoft/AndroidJniBridgeGenerator/annotations/1.0/annotations-1.0.pom
       - https://repo.maven.apache.org/maven2/com/neborosoft/AndroidJniBridgeGenerator/annotations/1.0/annotations-1.0.pom
       - https://jcenter.bintray.com/com/neborosoft/AndroidJniBridgeGenerator/annotations/1.0/annotations-1.0.pom
     Required by:
         project :app > project :Logic

As you see it doesn't try to search in the local Maven repository. Do you know how to fix it?

CodePudding user response:

Place your:

mavenLocal()

in app's gradle file

CodePudding user response:

The buildscript clause is only used for resolving plugins (and their depedencies). Add another repositories clause outside the buildscript like so:

buildscript {
    repositories {
        mavenLocal()
        ...
    }
    ...
}
repositories {
    mavenLocal()
    ...
}
  • Related