Android studio 2.2.3 构建错误 [英] Android studio 2.2.3 building error

查看:30
本文介绍了Android studio 2.2.3 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的 android studio 更新到 2.2.3,现在当我创建一个新项目时出现此错误:

I updated my android studio to 2.2.3 and now when I create a new project I get this error:

我尝试了所有解决方案,例如:

I tried all the solutions such as:

  • 降级gradle
  • 将 _JAVA_OPTIONS 值编辑为-Xms2048m"
  • dexOptions {javaMaxHeapSize "4g"}

我的 build.gradle:

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "ir.pdnco.myapplication"
    minSdkVersion 15
    targetSdkVersion 25
    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:25.1.0'
testCompile 'junit:junit:4.12'
}

我也更改了 gradle.properties,但仍然出现此错误

I also changed the gradle.properties, but still getting this error

推荐答案

这会解决它

apply plugin: 'com.android.application'

repositories {
    flatDir {
        dirs 'libs' // flatten library directory
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "ir.pdnco.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        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:25.1.0'
    testCompile 'junit:junit:4.12'
}

这篇关于Android studio 2.2.3 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆