Android Studio Gradle Sync失败

问题描述 投票:0回答:1

我一直在尝试使用一些内置视图运行一个简单的应用程序,但在Android Studio启动时,Gradle同步完成时几乎没有错误。我尝试过在互联网上看到的多种方法,但没有任何效果。我还从Android Studio文件中替换了gradle-2.14.1文件夹,通过下载zip文件并解压缩,但这也不起作用。

以下是build.gradle(Project)的代码:

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

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

        // 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(app)代码:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.heenamehta.myapplication"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree( dir: 'libs' , include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    testCompile 'junit:junit:4.12'

}

摇篮 - 包装 - 属性:

#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

我还在“消息”部分附加了显示错误的图像。 Here is the image另外有关额外信息,我正在使用:带有SDK API级别23的Android Studio 2.2.3和构建工具25.0.2

android gradle android-studio-2.2
1个回答
0
投票

在你的build.gradle [app-level]导入所有这些库,列在错误列表中,并更新你的android工作室 -

    dependencies {
        compile fileTree( dir: 'libs' , include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.android.support:design:23.4.0'

        //Here - add all of those libraries dependencies
        testCompile 'junit:junit:4.12'
    }
© www.soinside.com 2019 - 2024. All rights reserved.