Android studio错误(17,0)无法找到方法maven()

时间:2017-09-11 01:36:29

标签: java android maven

Project Gradle

print("".join([bcolors.BOLD, self.name])) 

模块Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
    }
    repositories {
        google()
    }
}

allprojects {
    // ...
    dependencies {
        // ...
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

获取错误

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.0'

    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 19
        targetSdkVersion 23

    }


    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.firebase:firebase-core:11.2.2'
    compile project(':rateMyApp')
    compile files('libs/android-async-http-1.4.6.jar')
    compile files('libs/com-uvxghdmx-ucuwreks167365.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile files('libs/universal-image-loader-1.9.3.jar')
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.google.android.gms:play-services-ads:11.2.2'
}
apply plugin: 'com.google.gms.google-services'

请帮助我......

1 个答案:

答案 0 :(得分:2)

你可以通过将mavenCentral()添加到存储库中来解决这个问题,然后将代码添加到mavenCentral()行下面的存储库中,然后重新同步:

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

这应该消除与同步的冲突。