Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find method maven()

I am getting the following error :

Could not find method maven() for arguments [build_3sdtqstdmsgdnexrxaaxgljji$_run_closure1$_closure4@325a800c] on root project 'Appointments' of type org.gradle.api.Project.

Here's my Project Level Gradle File:

buildscript {

repositories {
    google()
    jcenter()
    maven { url "http://jcenter.bintray.com"}
    maven { url "https://maven.fabric.io/public" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:4.0.0'
    classpath 'io.fabric.tools:gradle:1.25.4'


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

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

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

And here's my app level Gradle File :

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.gtaandteam.android.wellcure"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
 }
}

repositories {
mavenCentral()
maven {
    url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'ai.devsupport.instamojo:instamojolib:0.1.6'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-crash:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation "com.android.support:design:24.2.0"
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'


}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

I have tried all the techniques mentioned in other posts and solution website, but I dont find my same error listed in any of these websites. Hence I am creating this question here.

like image 702
Glenn Alex Avatar asked Jul 24 '18 08:07

Glenn Alex


1 Answers

You're getting this error because your maven shouldn't be a direct child of "allprojects" but a direct child of "repositories".

allprojects {
  repositories {
    google()
    jcenter()

    maven {
      url 'https://maven.google.com/'
    }
  }
}
like image 110
kemicofa ghost Avatar answered Oct 31 '22 13:10

kemicofa ghost