【问题标题】:Android studio 2.2.3 building errorAndroid studio 2.2.3 构建错误
【发布时间】:2017-01-02 17:21:05
【问题描述】:

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

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

  • 降级 gradle
  • 将 _JAVA_OPTIONS 值编辑为“-Xms2048m”
  • dex 选项 { 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,但仍然出现此错误

【问题讨论】:

  • classpath 'com.android.tools.build:gradle:2.2.2'怎么样
  • @IntelliJAmiya 试过了,还是没有变化
  • 看看这对你有没有帮助stackoverflow.com/questions/28917696/…
  • 添加multiDexEnabled true
  • @IntelliJAmiya 做到了,没用...

标签: java android android-studio


【解决方案1】:

这会解决它

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-05
    • 2014-05-08
    • 2015-05-10
    • 2018-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多