0

Trying to compile my android app with google app engine module but the darn thing won't work. It WAS working before but for some reason after I cleared my Android Studio cache and restarted, it stopped compiling. Here is the error I get:

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

I checked the folder and the above file does not even exist - so why does it try to delete it?

I also tried putting in a dummy file with the above name hoping that might work but it did not.

Here are what my gradle files look like:

app

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

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.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
}
Harshal Patil
  • 6,659
  • 8
  • 41
  • 57
Micro
  • 10,303
  • 14
  • 82
  • 120

2 Answers2

1

Very dumb but for some reason (I have no clue why) Android studio added this line to my file

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 module getting really annoying to make these days...

Micro
  • 10,303
  • 14
  • 82
  • 120
-1

In your build.gradle script, set the dexOptions.javaMaxHeapSize configuration

android {
            ...
            ...

    dexOptions {

        javaMaxHeapSize "4g"
    }
}
Pavan Bilagi
  • 1,618
  • 1
  • 18
  • 23