简体   繁体   English

Gradle 不在本地 Maven 存储库中搜索包。 怎么修?

[英]Gradle is not searching for packages in local Maven repository. How to fix?

Here is my root build.gradle file这是我的根 build.gradle 文件

// 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:当我尝试运行./gradlew:app:compileDebugKotlin我得到这个:

* 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.如您所见,它不会尝试在本地 Maven 存储库中搜索。 Do you know how to fix it?你知道如何解决吗?

Place your:放置您的:

mavenLocal()

in app's gradle file在应用程序的 gradle 文件中

The buildscript clause is only used for resolving plugins (and their depedencies). buildscript子句仅用于解析插件(及其依赖项)。 Add another repositories clause outside the buildscript like so:buildscript之外添加另一个repositories子句,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM