我使用Android Studio 1.0.2和Gradle。 gradlew命令compileDebugJava运行得很好,但是当我运行compileDebug时,构建过程会遇到app:preDexDebug。当我从Windows命令提示符运行命令时,我可以看到处理该步骤总是在冻结前经过78%。没有错误消息。它只是卡住了。
如果需要,请提供更多信息,因为我还没有提供,因为我不知道什么是有用的。
在我将目标Android API从19更改为21之前,稍微改变了我的依赖性。这些是我目前的依赖:
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'ch.acra:acra:4.5.0'
compile 'com.google.android.gms:play-services-games:6.5.87'
compile 'com.google.android.gms:play-services-plus:6.5.87'
compile 'com.google.android.gms:play-services-appstate:6.5.87'
compile 'com.android.support:appcompat-v7:21.0.3'
}
修改
这是我执行命令gradlew compileDebug --debug
19:41:12.705 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':app:preDexDebug'.
19:41:12.709 [INFO] [org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs] All input files are considered out-of-date for incremental task ':app:preDexDebug'.
19:41:12.727 [INFO] [org.gradle.api.Project] deleteDir([project path]\app\build\intermediates\pre-dexed\debug) returned: true
19:41:12.883 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.3-f48e1e2d7fed6fd712d566edcfe5446521dd959c.jar [sdk path]\extras\android\m2repository\com\android\support\support-annotations\21.0.3\support-annotations-21.0.3.jar
19:41:12.884 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\classes-920ebcdb8b3cfaba9b90d0f66feb55760d423363.jar [project path]\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appstate\6.5.87\classes.jar
19:41:12.884 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\classes-86902da0c51206b900608e2edb367d123dbaf04f.jar [project path]\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-plus\6.5.87\classes.jar
19:41:12.884 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.3-3d47273c8cdf03ba3e7b9c20952c50740d93498c.jar [project path]\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.3\libs\internal_impl-21.0.3.jar
19:41:12.885 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\acra-4.5.0-adedb5c8d6e931ec4ff3c31d7e45ba018b21026a.jar [user root]\.gradle\caches\modules-2\files-2.1\ch.acra\acra\4.5.0\44a5eb946e0d83eed4a0128d877ca1fd8168b83a\acra-4.5.0.jar
19:41:12.903 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\classes-048b7b5d8c155de5d2796564db58a43a8b9cc429.jar [project path]\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-games\6.5.87\classes.jar
19:41:12.911 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\classes-73e2551a5d112c60cea4e094fef4cf6fa73f8986.jar [project path]\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\6.5.87\classes.jar
19:41:12.926 [INFO] [org.gradle.api.Project] command: [sdk path]\build-tools\20.0.0\dx.bat --dex --verbose --output [project path]\app\build\intermediates\pre-dexed\debug\classes-dc8324f5ce54136fc613d3f6f22fd716ccf64d9d.jar [project path]\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\classes.jar
EDIT2:
我尝试的事情:
EDIT3:
现在它遇到了mergeDebugResources与一个非常相似的信息转储。
Edit4:
构建在我的Linux机器上运行,具有完全相同的源文件和完全相同的设置。
答案 0 :(得分:0)
这不是一个明确的答案,但它是与系统进行大量斗争的结果。
当构建过程被强制停止时,似乎会出现错误。 adb似乎处于一种奇怪的状态,之后它总是会被卡住。此外,因为您无法再完成构建,所以错误会堆叠并且可能会变得更糟。
当您安装Android API的预览版本并稍后将其升级到完整版本时,也可能会出现此问题。对我来说,这发生在Android L预览版本中。
遇到此错误时尝试的内容
classpath 'com.android.tools.build:gradle:1.0.0'
,在根目录中有一行task wrapper(type: Wrapper) { gradleVersion = '2.2.1' }
。对我而言,当我将Android Studio从1.0.2更新为1.1时,这已得到修复。我不确定这是否是实际的修复方法,或者在我这样做的时候还有其他修复方法。