1

I'm using Android Studio 1.0.2 and Gradle. The gradlew command compileDebugJava runs just fine, but when I run compileDebug the building process gets stuck to app:preDexDebug. When I run the command from Windows command prompt, I can see that processing the step always goes 78% through before freezing. No error messages. It just gets stuck.

Please request more information if needed as I haven't provided it just because I don't know what's useful.

Before I changed my target Android API from 19 to 21 and slightly changed my dependancies. These are my current dependancies:

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'
}

Edit:

These are the last lines I get after executing command 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:

Things I've tried:

  • Cleaning the project
  • Downloading my whole project again from the Git repository removing any additional files in the process
  • Invalidating Android Studio caches
  • Excluding play-services-base from two of the gms packages, because apparently it comes bundled

Edit3:

Now it gets stuck to mergeDebugResources with a pretty similar info dump.

Edit4:

Building works on my Linux machine with the exactly same source files and exactly same settings.

Finnboy11
  • 986
  • 2
  • 15
  • 34

1 Answers1

0

This is not a definitive answer, but it's a result of a lot of fighting with the system.

The error seems to come when the building process is stopped by force. The adb seems to go to a weird state in which it will always get stuck afterwards. Moreover, because you can't finish the build anymore the error will stack and may get worse.

The issue may also appear when you have installed a preview version of an Android API and later upgrade it to the complete one. To me this happened with the Android L preview version.

What to try when facing this error

  • If you have recently changed your target API, check your main build.gradle file. At the moment (SDK 21, build tools 21.1.2) it should have a line classpath 'com.android.tools.build:gradle:1.0.0' in dependencies and the lines task wrapper(type: Wrapper) { gradleVersion = '2.2.1' } in the root.
  • Clean your project
  • If you know you have installed a preview API and later updgraded it, remove all packages of that API and make sure that it leaves no traces. Then reinstall it.
  • Check that your dependancies do not import the same package twice. Quite many packages import one of the android support libraries. You can exclude packages like this.
  • Wait for the next Android Studio version or the next API version (stupid solution, I know).
  • If you have virtual machines or other systems, try to run the project with those (even more stupid solution, I know).

To me this was fixed when I updated my Android Studio from 1.0.2 to 1.1. I'm not sure if this was the actual fix or if something else fixed it while I did this.

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
Finnboy11
  • 986
  • 2
  • 15
  • 34