簡體   English   中英

Android Studio錯誤(17,0)找不到方法maven()

[英]Android studio error (17, 0) could not find method maven()

項目搖籃

// 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'

遇到錯誤

Error:(17, 0) Could not find method maven() for arguments [build_2rpdxydj6arlyq4m2v87kde3g$_run_closure1$_closure2$_closure3@70ca8e63] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

請幫我...

您可以通過將mavenCentral()添加到存儲庫,然后將代碼添加到mavenCentral()行下方的存儲庫中來解決此問題,然后重新同步:

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

這樣可以消除與同步的沖突。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM