该项目的Gradle设置尚未配置-Android Studio

时间:2018-08-29 10:21:16

标签: android build.gradle

我正在尝试加载现有项目,但遇到了以下问题:

enter image description here

单击“确定”,我将得到以下内容:

enter image description here

enter image description here

搜索here我还没有发现Grangle 2.2.2。最小框号是3.0.0

build.grandle

  // Top-level build file where you can add configuration options common to all sub-projects/modules.

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

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

allprojects {
repositories {
    jcenter()
    }
}

app.build.grande

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'

defaultConfig {
    applicationId "com.prouast.heartbeat"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

// add a task that calls regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
    def ndkDir = android.ndkDirectory
    commandLine "$ndkDir/ndk-build",
            '-C', file('src/main/jni').absolutePath, // relative path to jni source
            'NDK_LIBS_OUT=../jniLibs',
            '-j', Runtime.runtime.availableProcessors(),
            'all',
            'NDK_DEBUG=1'
}

task ndkClean(type: Exec, description: 'Clean JNI object files') {
    def ndkDir = android.ndkDirectory
    commandLine "$ndkDir/ndk-build",
            '-C', file('src/main/jni').absolutePath, // relative path to jni source
            'NDK_LIBS_OUT=../jniLibs',
            'clean'
}

// add this task as a dependency of Java compilation
tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(['ndkBuild'])
}

clean.dependsOn(['ndkClean'])

sourceSets.main {
    jni.srcDirs = []
    //jniLibs.srcDir 'src/main/libs'
}

buildTypes {
    debug {
        debuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
    }
}

dependencies {
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project(':libraries:opencv')
}

需要我在应用程式大叔上更改某些内容,还是有人有建议? 您能否建议我一些链接来关注或逐步解释我该如何解决?

编辑: 将jcenter添加到gradle.build解决了该问题:

buildscript {
    repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
}

2 个答案:

答案 0 :(得分:0)

只需单击OK,Studio即可自动执行Gradle配置。

答案 1 :(得分:0)

单击“确定”以进行Gradle包装,或在build.gradle中手动进行并更新以下行:

    **classpath 'com.android.tools.build:gradle:3.2.1'**