The new Android project, after introducing the Jiguang demo, reports an error Build was configured to prefer settings repositories over project repositories

A new Android project, after introducing the Jiguang demo, reported an error A problem occurred evaluating project ':jiguang'. > ​​Build was configured to prefer settings repositories over project repositories but repository 'flatDir' was added by build file 'jiguang\build.gradle'

The wrong line is located. The flatDir of build.gradle in the demo module is wrong. It probably means: the error message is about the repository 'flatDir'configuration problem. According to the error message, the build is configured to use the setup's repo in preference to the project's repo, but the repo build.gradleis added to the file flatDir. These are all pitfalls left by the management method of upgrading the new version of AS. They have always upgraded as they please, regardless of whether the coders live or die

solution:

Directly put the build.gradle in the module

        flatDir { 
            dirs 'libs'
        }

Move into your project's settings.gradlefiles like so:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        flatDir { // 将这段代码移到这里
            dirs 'libs'
        }
    }
}

You can also copy it directly for the personal test. If you move it and report an error, you can try copying it.

Guess you like

Origin blog.csdn.net/Spy003/article/details/130785944