Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.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 Studio Gradle DSL方法:';编译()';_Android_Android Studio - Fatal编程技术网

未找到Android Studio Gradle DSL方法:';编译()';

未找到Android Studio Gradle DSL方法:';编译()';,android,android-studio,Android,Android Studio,我得到以下错误: Error:(4, 0) Gradle DSL method not found: 'compile()' Possible causes:The project 'Jp' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file.The build file may be missing a Gradle plugin. 我试着寻找其他类似的问题,但

我得到以下错误:

Error:(4, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'Jp' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file.The build file may be missing a Gradle plugin.
我试着寻找其他类似的问题,但没有任何效果。 我的build.gradle(项目:JP)文件如下:
错误:(4,0)找不到Gradle DSL方法:“compile()”

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
build.gradle(模块:应用程序)

build.gradle(sdk-audio-1.60.1)

settings.gradle:

include ':app', ':sdk-audio-1.60.1'
有人能帮我修一下吗


谢谢

您的build gradle工具似乎太旧了,请更改root build.gradle中的以下行:

classpath 'com.android.tools.build:gradle:1.5.0'

别忘了将google maven添加到您的build.gradle中:

maven { url "https://maven.google.com" }
这是因为所有支持库都移动到maven,如发布说明中所示:

重要提示:支持库现在可以通过谷歌的 Maven存储库。您不需要下载支持存储库 来自SDK管理器。有关详细信息,请参见支持库设置

那么您的root build.gradle将是这样的:

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

错误:(1,0)支持的最低渐变版本为3.3。目前的版本是2.8。如果使用gradle包装器,请尝试在C:\Users\Jal\Jp\gradle\wrapper\gradle-wrapper.properties中编辑distributionUrl到gradle-3.3-all.zip。我如你所述做了,但出现了此错误。你能帮忙吗?这意味着你应该升级gradle。尝试将C:\Users\Jal\Jp\gradle\wrapper\gradle-wrapper.properties中的行更改为
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
inI这样做了..这需要花费很长时间来构建..非常感谢..感谢.错误:(4,0)找不到参数[project]:app']在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上。下面是文件:configurations.create(“default”)artifacts.add(“default”,file('sdk-audio-1.60.1.aar'))dependencies{compile project(':app')}对不起,我忘了告诉你那部分。将其更改为编译项目(路径:':sdk-audio-1.60.1')
classpath 'com.android.tools.build:gradle:2.3.3'
maven { url "https://maven.google.com" }
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}