Android Studio not using gradlew?

2,168 views
Skip to first unread message

Daniel Lew

unread,
Aug 1, 2013, 11:08:57 AM8/1/13
to adt...@googlegroups.com
Hey,
I'm giving Gradle/Android Studio another shot after a short hiatus.  I cleared out all my AS files and cleaned my gradle build to start.  I'm doing fine building gradle on the command line (with gradlew) but when I try to make the project in AS it blows up with this error:

Gradle: Execution failed for task ':project:dexEBadDebug'.
> Failed to run command:
  /Library/android-sdk/build-tools/18.0.1/dx --dex --incremental --no-strict --output /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/libs/project-EBad-debug.dex /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/classes/EBad/debug /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/dependency-cache/EBad/debug /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/adxtag2.4.4exp.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibOpinionLabUnspecified.aar/libs/CWAC-Parcel.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibActionBarSherlockActionbarsherlockUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibFlightLibUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibOpinionLabUnspecified.aar/libs/oosdk.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/nineoldandroids-2.4.0.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibUtilsUnspecified.aar/libs/HockeySDK-3.0.0.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibGooglePlayServicesUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibSvgAndroidSvgandroidUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/jackson-core-asl-1.8.0.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibJarsUnspecified.aar/libs/maps-17_r3.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibGooglePlayServicesUnspecified.aar/libs/google-play-services-second-party.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibUtilsUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibJarsUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/libGoogleAnalyticsV2.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/admsAppLibrary-3.0.5.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibUtilsUnspecified.aar/libs/disklrucache-1.2.1.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibFacebookSdkFacebookUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibOpinionLabUnspecified.aar/classes.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibUtilsUnspecified.aar/libs/FlurryAgent.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/gcm.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/libs/activeandroid-20130607.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibJarsUnspecified.aar/libs/compatlib-v18-2013-07-31.jar /Users/dlew/mobiata/gitrepos/ExpediaBookings/project/build/exploded-bundles/ExpediaBookingsLibUtilsUnspecified.aar/libs/trace.jar
  Error Code:
  1
  Output:
  Unable to locate a Java Runtime to invoke.

What's interesting is that if I build on the command line, then the project in AS also runs fine (I think because it doesn't have to run the command that it can't do).  But I'm not sure why it's running that command in the first place when it should be using the gradle wrapper.  (Nor can I figure out why it can't find the Java Runtime).

Thoughts?

-Daniel

Przemek Jakubczyk

unread,
Aug 2, 2013, 7:37:57 AM8/2/13
to adt...@googlegroups.com
Hi Daniel,

I'm getting the same problems after updating to 0.2.3. I rolled back to 0.2.0 and everything went back to normal state.

Hope this bug is going to be fixed very soon.

Rob Dupuis

unread,
Aug 2, 2013, 8:01:01 PM8/2/13
to adt...@googlegroups.com
I'm also seeing this problem, but for me it is intermittent. I seem to have fixed it by stopping the Gradle daemon which I had running from the command line. But I've no idea if this was just coincidence.

Is anyone else running the daemon?

Alex Ruiz

unread,
Aug 2, 2013, 9:36:37 PM8/2/13
to adt...@googlegroups.com
In 0.2.3 we did not change how we build projects in Android Studio. What we changed in 0.2.1 is that, in order to ensure that we use only 1 daemon for project creation/import and building, we pass the path of the Java home to the Gradle daemon while building a project.

Can you (actually, all of you in this thread) please attach the idea.log and build.log files from Studio? (go to menu "Help" > "Show log" - build.log is in folder build-log).

Thanks,
-Alex


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Rob Dupuis

unread,
Aug 3, 2013, 11:05:07 AM8/3/13
to adt...@googlegroups.com
I've attached the log files requested for a brand new project with the default settings. The dex error only happens for me when gradlew --daemon has been started on the command line. 

I've only just started using the daemon from the command line since I've been on 0.2.3. I was on 0.2.2 previously (building from IDE only, not the command line), and didn't see the problem.

Hope this helps,
Rob
build.log
idea.log

Daniel Lew

unread,
Aug 13, 2013, 10:33:53 AM8/13/13
to adt...@googlegroups.com
Sorry for dropping the ball, but I've finally come back with results.  Attached are the requested files.  I should be running latest gradle, android gradle and AS.

Still in the same boat as before - command line builds work, but AS can't find Java Runtime to invoke.

-Daniel



--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/qBE3EdjqlJQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.
build.log
idea.log

orip

unread,
Aug 21, 2013, 4:11:35 PM8/21/13
to adt...@googlegroups.com
We also get this error on our team, maybe this will help somebody.
  • We commonly build through Android Studio and through the gradle command-line.
  • We have Oracle's JDK 1.7 installed.
  • Gradle on the command line uses the 1.7 JVM (seen by running 'gradle -version'). Android Studio uses the system default 1.6 JVM.
  • It's possible that Android Studio's gradle finds the gradle daemon created on the command line with 1.7, which it can't use.
Since we don't need the 1.7 default, our fix was to kill any lingering gradle daemons and update JAVA_HOME in the terminal to point to 1.6 (e.g. through ~/.zshenv):
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)

Osram Lux

unread,
Jan 23, 2014, 8:11:52 AM1/23/14
to adt...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages