Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:(40,0)找不到参数[目录'libs'的方法实现()_Android_Android Studio - Fatal编程技术网

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

Android 错误:(40,0)找不到参数[目录'libs'的方法实现(),android,android-studio,Android,Android Studio,我试着从2天开始运行我的android studio,最后它显示错误400,我的build.gradle文件如下所示 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' } } allprojects { repositories { jcenter() } } apply plugin: 'com.android

我试着从2天开始运行我的android studio,最后它显示错误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
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'
它应该是编译的,而不是实现的,对于android特定的测试,它是androidTestCompile。应该是这样的

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

为什么要执行实现而不是编译?参考编辑:我刚刚读了一些文章,显然compile将在gradle 3.0中被弃用。你不能在android gradle 2.X.X中使用实现,你需要android gradle插件3.0.0当前处于alpha或更高版本。我更改了gradle文件,但现在它显示了这一点。错误:40,0在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找不到参数[directory'libs']的方法complie。@kunal007尝试像这样交换参数compile fileTreeinclude:['*.jar',dir:'libs'@kunal007这是打字错误吗?它是编译而不是编译的。注意,它是在Gradle3+中实现的。不编译。