错误:(40,0)无法找到参数的方法实现()[目录' libs']

时间:2017-07-14 09:42:41

标签: android android-studio

我试图在2天内运行我的android工作室,最后它显示错误400,我的build.gradle文件看起来像这样

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
}
}

allprojects {
repositories {
    jcenter()
}
}
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
    applicationId "com.armenhovhannisyan.backpaper.backpaper"
    minSdkVersion 25
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner                      "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
    }
}
productFlavors {
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-    core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0-beta1'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:25.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-annotations:25.3.1'
}

更新并对我的gradle.properties文件进行一些更改后,它看起来像这样

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details,  visit
 #        http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decou    pled_projects
# org.gradle.parallel=true
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-    all.zip

1 个答案:

答案 0 :(得分:10)

它应该是compile而不是implementation,对于Android特定的测试,它是androidTestCompile。看起来应该是这样的

compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile'com.android.support:design:25.0.0-beta1'
compile'com.android.support.constraint:constraint-layout:1.0.2'