【问题标题】:Could not find method compile() for arguments [com.android.support:cardview-v7:27.0.2]找不到参数的方法 compile() [com.android.support:cardview-v7:27.0.2]
【发布时间】:2018-01-16 18:33:02
【问题描述】:

我尝试将两个项目结合起来。我的 SDK 已更新,但每次运行代码时都会出现此错误。

Error:(19, 0) Could not find method compile() for arguments 
[com.android.support:cardview-v7:27.0.2] on object of type 
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK Manager.

我的所有支持存储库都已下载。一直在寻找这个解决方案太久,但失败了。 这是我的 android/app/build.gradle 文件的代码。

apply plugin: 'com.android.application'

android {
     compileSdkVersion 27
defaultConfig {
    applicationId "pingo.betnek.hospiva"
    minSdkVersion 17
    targetSdkVersion 27
    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()
 }

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

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.0.2'
//    compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.github.f0ris.sweetalert:library:1.5.1'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.android.support:recyclerview-v7:27.0.2'
testCompile 'junit:junit:4.12'

// For Alert Notifications from top
compile 'com.tapadoo.android:alerter:2.0.1'
 }



apply plugin: 'com.google.gms.google-services'

请帮我解决这个问题。

【问题讨论】:

  • 发布你的项目级 build.gradle 文件

标签: java android maven


【解决方案1】:

我遇到了同样的问题,只是将其更改为

compile "com.android.support:appcompat-v7:27.0.0"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-29
    • 2022-01-23
    相关资源
    最近更新 更多