0

尝试使用 google app engine 模块编译我的 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
}
4

2 回答 2

1

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

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
}

伙计,Android Studio + GAE 模块这些天变得非常烦人......

于 2016-01-06T04:35:07.847 回答
-1

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

android {
            ...
            ...

    dexOptions {

        javaMaxHeapSize "4g"
    }
}
于 2016-01-06T03:41:29.657 回答