简体   繁体   English

Android Studio最新版本找不到参数目录库的编译方法

[英]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.

相关问题 查找当前版本和Adobe最新版本的Flash - Find current version AND Adobe's latest version of Flash 使用 JavaScript 从数组中查找最新版本的文件名 - Find latest version of file name from array using JavaScript 带有转义字符的jQuery查找功能在最新版本中不起作用 - jQuery find function with escape characters not working in latest version 确保用户在更新后获得网站最新版本的正确方法 - Correct method for ensuring users get the latest version of a website after an update 为什么JS方法replace()在最新版本的Safari中工作不正确? - Why does JS method replace() work incorrect in the latest version of Safari? 最新的 9.0 版本中是否有任何方法可以在 firebase 中创建嵌套集合? - Is there any method in the latest 9.0 version to create nested collection in firebase? React Native - 使用 android studio 编译包 - React native - compile bundle with android studio 如何将2个参数传递给jquery Find()方法 - How to pass 2 arguments to jquery Find() method 使用visual studio代码任务编译typescript,指定输出目录 - compile typescript with a visual studio code task, specifying the output directory Javascript:为什么数组切片方法可以将nodelist或参数转换为数组? - Javascript:why the array slice method could turn nodelist or arguments to array?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM