Just now I have installed and started working on Android Studio, and created new project after configuring everything I needed to start working on project. In newly created project, I have not changed anything and then tried to run the project. But it is not working and throwing some dependency error I guess. Here is it
Gradle: FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ‘:StudioTest2:
File ‘C:\Users\StudioTest2\StudioTest2\build\libs\StudioTest2-debug.dex’ specified for property ‘dexFile’ does not exist.
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
Could not execute build using Gradle distribution ‘http://services.gradle.org/distributions/gradle-1.6-bin.zip‘.
One thing I found that helped was to import the project after creating it, I was getting the same issue but once I imported the project (as opposed to just opening it), it built fine.
Any of the following may work:
1) clean project
2) File -> invalidate caches/ restart.
3) Restart computer.
4) See if some other project is compiling but not the current one. Notice the difference between the two and modify things in the current project if required.
I have wasted my 5 hours on this error.
Install Android Studio to the default installer location. Something like
C:\Users\<user>\AppData\Local\Android\android-studio. When you run it create your project again.
I did not want to use the AppData location to store the program (although that would work), and none of the other solutions worked.
What ended up working was simply using a path that did not have spaces for my Android Studio install location.
I was using:
I then changed it to:
When I was using Fedora for development, applications compiled, and I noticed the application zip extracted to android-studio.
Furthermore, using running gradle packageDebug within my project directory on windows did not work, even with –stacktrace –debug.
Further observations: This problem might not have anything to do with android studio. It might just be that the sdk folder in android-studio needs to be in a path without spaces.
I am under the impression that this would work for people using an alternate sdk location without spaces in the path.
Finally, projects not using build.gradle imported from eclipse worked just fine. Only projects created in android studio using gradle refused to compile and returned the curious dexFile packageDebug error.
Gradle projects now compile. Hope this helps someone.
This error because something is going wrong that must be take in knowlegde.
First of all download the gradle from this link
Then Extract it to anywhere in your PC.
After that Right click on My Computer icon –> Properties –> Advanced Setting –> Environment Variable –> System Variable
add the new path here like below.
Variable name : GRADLE_HOME.
Variable Value : path to your gradle.
After that run command promt then type gradle check that it properly works.
Set path to your Project root directory which content gradlew file.
After setting the path just type the folloeing command in your command promt.
Hope this will helps you.
Use your console to navigate to your project root directory where you will find gradlew script. run it with “compileDebug” option to see the exact error. There are other options to use as well, “gradlew help” will tell you more
I request apologizes about my bad English.
The solutions proposed did not worked in my case, but I managed to solve it myself.
My scenario was the following: created a project in an XP computer with eclipse, imported it to android studio, then I commited it to my SVN repository.
Later, I downloaded it to another computer with Windows 7 and Android Studio, and I obtained the discussed error (debug.dex’ specified for property ‘dexFile’ does not exist).
I tried all the proposed solutions without sucess. What worked for me? Two steps:
first, correct the JDK path under “File->Project Structure->Project”. At computer number I had JDK_1.6_016 and at computer number 2 I have JDK_7.
second: deleted (you can rename it if you dont want to delete it) the file “local.properties” in the project folder. It was pointing to the Android SDK folder in the Windows XP path style (documents and settings and so on instead of “users”).
Then my project compiled with sucess.
Edited: better than deleting the file local.properties, edit it and correct the path to the android sdk file
I seem to face this problem when I try to run the project in debug mode. Then it starts giving Gradle errors. I try the menu option “invalidate cache restart”, sometimes it works sometimes it doesn’t. I just close the android studio and try to run it after a while later, it works. I’m not sure what’s happening inside the software’s brain.
What you need to do as Nick was saying on the comments above:
for windows users:
open cmd as administrator and run:
for unix like os:
go to the root directory of the project and run:
sudo gradlew packageDebug
In case you are getting errors you are missing some repos from
maven.org go to
/Applications/Android Studio.app/sdk/tools or the the android studio directory on
Program files, and run
android in unix or
android.bat on windows.
i upgrade android studio from 0.3.1 to 0.3.2 and recreate project solved this problem.
Updating to latest build tool and restarting studio fixed the issue for me
Tools > Android > Monitor (DDMS included)
You will see SDK welcome message, and then go back to editor, and try to rebuild again.