android - Android Studio Gradle同步失败

标签 android gradle android-studio-2.2

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

这是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'

}

Gradle-wrapper-properties:
#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
另外有关额外信息,我正在使用:
Android Studio 2.2.3与
SDK API级别23和
生成工具25.0.2

最佳答案

build.gradle [应用程序级]中,导入所有这些库(列在错误列表中),并更新android studio-

    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'
    }

关于android - Android Studio Gradle同步失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44258594/

相关文章:

java - 无法访问Java中的资源文件夹

java - 如何将 gradle 配置为仅对某些依赖组使用本地存储库?

java - 在 Android Studio 2.2 中启用注释处理器选项

java - libGDX - 添加分数并将其显示在屏幕的左上角?

java - C2DM - 消息从服务器成功发送,但未显示在设备上

java - 一些生成的图标看起来比普通图标大

android - 忽略 Android API 神器 com.google.android :android:2. 2.1 进行调试/发布

Android View 在视觉上处于正常位置,但实际上 - 在 TranslateAnimation 之后的起始位置

android - 两个插件之间的Nativescript冲突-Android Gradle

java - Android Studio 2.2.3 Base.Theme.AppCompat 错误