[英]Android Studio latest version could not find method compile for arguments directory libs
I have pasted my build.gradle codes in this question, please suggest what to do. 我已经在这个问题中粘贴了build.gradle代码,请提出建议。
Error message: 错误信息:
Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
在org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler类型的对象上找不到参数[目录'libs']的方法compile()。
Configuration: 组态:
apply plugin: 'com.android.application'
ext {
supportVersion='27.1.1'
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.eassycars.www.dlservices"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
configure(':app') {
dependencies {
classpath 'com.android.tools.build.gradle:4.8.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile
testCompile 'junit:junit:4.12'
// google & support
implementation "com.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler :$supportVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
// utils
implementation 'com.github.bumptech.glide:glide:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
implementation 'com.koushikdutta.ion:ion:2.1.7'
implementation 'com.github.Commit451:bypasses:1.0.4'
implementation 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
implementation 'com.drewnoakes:metadata-extractor:2.9.1'
implementation 'com.orhanobut:hawk:2.0.1'
classpath 'com.google.gms:google-services:3.1.1'
compile 'com.android.support:support-annotations:27.1.1'
}}
}
}
first of all you got a "compile" statement under "compile fileTree" with empty library. 首先,您在带有空库的“ compile fileTree”下获得了“ compile”语句。 second change "compile fileTree" to "implementation fileTree"
第二次将“ compile fileTree”更改为“ implementation fileTree”
Go to your project's build.gradle and check it's version under dependencies. 转到项目的build.gradle并检查依赖项下的版本。
check project's build.gradle version 检查项目的build.gradle版本
If you're using a version of Gradle lower than 4.1 then use this 如果您使用的Gradle版本低于4.1,请使用此版本
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.