Could not find method jcenter() for arguments [] on repository container

后端 未结 8 559
温柔的废话
温柔的废话 2020-12-17 07:54

I\'m new to Gradle and bintray. I want to publish this project so it is readily available to Maven and SBT users. I am not the original author of this package; it appears to

相关标签:
8条回答
  • 2020-12-17 07:58

    It happened with me when I stopped the gradle downloading in between, to resolve this we have to delete the older gradle and update and sync

    to delete use

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

    to udpate, add this to your graddle-properties : distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

    And then sync

    0 讨论(0)
  • 2020-12-17 08:11

    Just to summarize the discussion in comments:

    Gradle added jcenter() shortcut in version 1.7. Any version prior to it will fail with this exception. You can still work with jcenter by adding it as a normal maven repo:

    repositories {
        maven {
            url "https://jcenter.bintray.com"
        }
        ....
    }
    
    0 讨论(0)
  • 2020-12-17 08:11

    I had the same trouble. In my case, it was a newie mistake. Maybe it could be helpful for anyone. I reverted the code from the one I changed to the original one.

    The code as I changed it:

    buildscript {
        ext.kotlin_version = '1.2.71'
        repositories { google()  jcenter()
        }
    

    The original code:

    buildscript {
        ext.kotlin_version = '1.2.71'
        repositories {
            google()
            jcenter()
        }
    
    0 讨论(0)
  • 2020-12-17 08:15

    As silly as it sounds, make sure you have jcenter on it's own line. I copy pasted some code and ended up with jcenter not on it's own line.

    allprojects {
        repositories {
            google {
                content {
                    ...
                }
            }                  jcenter() // DERP
            maven { url "https://jitpack.io" }
            maven { url 'https://maven.google.com/' } 
        }
    }
    
    0 讨论(0)
  • 2020-12-17 08:18

    Goto the Android project Tab, in explorer collapse Gradle Scripts.You will find a file called gradle-wrapper.properties .

    Open the file and select all and paste the following code below:

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
    

    Sync now

    But before that You have to make changes in build.gradle (Project) file

    Open the file select All and Copy into entire sheet the below code:

    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath 'com.google.gms:google-services:4.0.0'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven {url 'https://jitpack.io'}
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    Sync Now

    0 讨论(0)
  • 2020-12-17 08:23

    got this error when building an android app on command-line with the gradle command

    Try:

    ./gradlew

    instead of

    gradle

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