Failed to resolve: com.android.support.design:25.4.0

后端 未结 11 1358
误落风尘
误落风尘 2020-12-01 07:30

I added the following line to my build.gradle(Module:app):

compile \'com.android.support:design:25.4.0\' 

But when executing Gradle I\'m ge

相关标签:
11条回答
  • 2020-12-01 07:34

    Mr. Bhavesh Patadiya give us a good solution. However, I'd like to share something more, to make fix process more explicit.

    There are two "build.gradle" files under the project directory. Their pathes are to be "Your-project-root-dir/build.gradle" and "Your-project-root-dir/app/build.gradle" respectively. When you see the error information in your android studio, and try to trace the file, you will probably open the second one.

    You should add this statement in the first file ("Your-project-root-dir/build.gradle").

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    and add the statements in the second build.gradle ("Your-project-root-dir/app/build.gradle")

    dependencies {
        ...
        compile "com.android.support:support-core-utils:27.0.2"
    }
    
    0 讨论(0)
  • 2020-12-01 07:34

    If you still have the issue, check the project settings for offline mode. if offline mode is on, then off and sync the project. That fixed my issue.

    0 讨论(0)
  • 2020-12-01 07:35

    A more updated version of the answer of "Bhavesh Patadiya" :

    1. In your project build.gradle file, add google() into the repositories blocks:

      repositories {
          jcenter()
          google()
      }
      
    2. Update the same file with a newer Gradle version:

      classpath 'com.android.tools.build:gradle:2.3.3'
      
    3. If the above cause you new issues or the same issue, exit Android-Studio, and delete the "gradle" folder/s (maybe also ".gradle" folder) and the "build" folder and sub-folders, and then open Android-Studio again.

    0 讨论(0)
  • 2020-12-01 07:35
    allprojects {
        repositories {
            google()
            jcenter()
            mavenCentral()
        }
    }
    
    0 讨论(0)
  • 2020-12-01 07:38

    Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.

    Step 1: Open the build.gradle file for your application.

    Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    Step 3: Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:

    dependencies {
        ...
        compile "com.android.support:support-core-utils:25.4.0"
    }
    
    0 讨论(0)
  • 2020-12-01 07:39

    Always keep appcompact version and support lib versionssame, so change com.android.support:design:25.4.0 to com.android.support:design:25.3.1

    0 讨论(0)
提交回复
热议问题