试图用谷歌应用程序引擎模块编译我的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
我检查了文件夹,上面的文件甚至不存在——那么它为什么要删除它呢?
我还试着用上面的名字放一个伪文件,希望它能起作用,但没有。
以下是我的渐变文件:
应用程序
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
}
非常愚蠢,但出于某种原因(我不知道为什么)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
}
伙计,安卓Studio+GAE模块这些天真的很烦人。。。
在build.gradle脚本中,设置dexOptions.javaMaxHeapSize配置
android {
...
...
dexOptions {
javaMaxHeapSize "4g"
}
}