Google App Engine模块错误:任务':app:transformClassesWithDexForDebug'执行失败。 > java.io.IOException:无法删除

时间:2016-01-06 02:49:20

标签: android google-app-engine google-cloud-messaging android-gradle gae-module

尝试使用谷歌应用程序引擎模块编译我的Android应用程序但是这个糟糕的事情不会起作用。它之前正在工作但由于某些原因我清除了我的Android Studio缓存并重新启动后,它停止了编译。这是我得到的错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> java.io.IOException: Failed to delete /Users/Me/AndroidStudioProjects/MyCoolApp/app/build/intermediates/pre-dexed/debug/appengine-api-1.0-sdk-1.9.18_0179742441e08a2aeb8477eb85038e2130d180e7.jar

我检查了文件夹,上面的文件甚至不存在 - 那为什么要尝试删除呢?

我也尝试使用上面这个名字输入一个虚拟文件,希望它可以工作,但事实并非如此。

以下是我的gradle文件的样子:

应用

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.me.mycoolapp"
        minSdkVersion 13
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
    testCompile 'junit:junit:4.12'
    compile project(path: ':backend', configuration: 'android-endpoints')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile project(':backend')
}

apply plugin: 'com.google.gms.google-services' // Needed for GCM

项目:

// 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.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3' // Needed for GCM
        // 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
}

2 个答案:

答案 0 :(得分:1)

非常愚蠢,但出于某种原因(我不知道为什么)Android studio将此行添加到我的文件中

compile project(':backend')

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
    testCompile 'junit:junit:4.12'
    compile project(path: ':backend', configuration: 'android-endpoints')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    //compile project(':backend') //DELETE THIS
}

Man,Android Studio + GAE模块让这些日子变得非常烦人......

答案 1 :(得分:-1)

在build.gradle脚本中,设置dexOptions.javaMaxHeapSize配置

android {
            ...
            ...

    dexOptions {

        javaMaxHeapSize "4g"
    }
}