When I try to run an Android emulator, I get the following error screen. The same occurs when I export the apk. When I go to the directory where the apk will be saved, the apk file is not there.
Thank you,
christophe
When I try to run an Android emulator, I get the following error screen. The same occurs when I export the apk. When I go to the directory where the apk will be saved, the apk file is not there.
Thank you,
christophe
I had the same issue, this problem will be fixed by doing the below step.
Go to
File->Setting->Gradle->Gradle Vm Option
For Android Studio 1.2
File->Setting->Build, Deployment &Execution->Build Tools->Gradle->Gradle Vm Option
, Now put this value -Xmx256m
in the box, and hit the Apply button.
Note the error will usually be listed as the first line (improperly formatted for Android Studio Gradle console such as:
AGPBI: {"kind":"error","text":"Float types not allowed (at \u0027icon_alpha_active\u0027 with value \u00270.75\u0027).","sources":[{"file":"/Users/mingsheng/path/to/my/errenous/integers.xml","position":{"startLine":5,"startColumn":38,"startOffset":272,"endColumn":42,"endOffset":276}}],"original":""}
Where "text" = error message, "sources: file" = errenous filepath/name
In this example, I have entered a Float value in the integers file.
This dialog box with empty cause also comes when there is some error in your resource(res) directory. Check for any error in layout files etc.
I had this issue too. It caused by mistake in dimens.xml (git helps me found it).
I used
<dimen name="map_search_view_top_margin">100</dimen>
instead
<dimen name="map_search_view_top_margin">100dp</dimen>
Hope it helps.
This is a mistake somewhere in your xml files. Check
values.xml
colors.xml
strings.xml
dimens.xml
Something wrong with opening closing bracket or something you missed in these files.
Honestly speaking, to me none of the above solutions worked and i almost fought over this for 3 days. Finally ultimate solution was to backup my project, uninstall studio and its trace files completely, clear files from temp, %temp% and prefetch folders and then reinstall all over again and finally it worked.
Pls discard my above answer which i taught was one of the solutions. I faced this problem repeatedly because 1 of my teammate forgot to include git.ignore file while pushing code to bitbucket and everytime i used to pull that code and then gradle used to pop the above problem. And after figuring out that, i have added proper git.ignore file and now there's no any problem on any1's pc :)
I am often getting that error when I have a typo in my xml. Open the gradle console and scroll up to the first red lines that appear. It will tell you the exact problem.
I have this problem, too. I used Gradle v.1.3.1 but Android Studio version is v1.2.2. Just update Android Studio to v.1.3.2 solved my problem.
In my case the root of the problem was, I deleted some resources that some xml files were refering to, and in that case neither of "Clear Project" "Rebuild Project" "Gradle VM Option" or "deleting .gradle folder" helped at all.
What more to say is, none of the mentioned xml files were in use, and no error was displayed anywhere. I only detected the problem when (in desperate) sync'ed Gradle, and then opened the Gradle console and scrolled up and read the red error lines.
None of the solutions worked for me. So I found this solution here:
My Android Studio was using JDK 1.8, so I switched back to JDK 1.7 and now it is working!
Go to
File > Project Structure > SDK Location
I had JDK Location set as jdk1.8.0_05. I just changed it to jdk1.7.0_79 and everything works fine now.
I had the same issue. After an hour of struggle, it's finally fixed.
First I updated Android Studio to 1.3.2. That did not fix the problem immediately, but at least it gave a proper error when trying to run the application.
(for me, there was something wrong with JAR dependencies so I removed them and it's running now, but that's probably irrelevant)
When you have an error like this. Just move to your BOTTOM RIGHT corner of the screen there is something known as GRADLE CONSOLE open that and read what went wrong. That helped me.
Try to upgrade your android studio, and when you run your project again, it will tell you where the problem is.
For me, I encountered this problem several times, the first time is something wrong with the style.xml, and the second time is string.xml file. Anyway, It seems Android studio could not find something wrong with .xml file.
But anyway, try to "refresh" your Android studio and let it tell you where are the problems, even reinstall it.
good luck!
I had the same problem, and the problem was gone after upgrading my Android Studio from 1.2.1 to 1.5.1. There was no error even after adding --stacktrace --info
to VM options. Gradle tasks would finish successfully, but the application just wouldn't launch (and studio would gray out the run button forever, probably waiting for a response from emulator). I had tried everything else mentioned here.
On newer version of AS 2.0 File->Setting->Build, Deployment &Execution-Compilers->Android Compilers->Gradle->Gradle Vm Option
put this as an option -Xmx256m
This can be because you have specified any command line option in android studio settings. You can check this by going to
File > Settings > Build, Execution, Deployment > Compiler
and see "Command-line-options" and check if anything is give. (In your case -x). If so remove it and click Apply and Ok. It worked for me...
I accidentally deleted string from string.xml and I didn't know it was specified in manifest for activity name, so spent one hour to discovered that out
I cleaned up the project, tried again and the problem was gone.
I had a "Run" problem in Android Studio due to multiple instances of Android Studio were opened. So I closed all instances and opened only on instances for which I wanted to generate APK.And It worked well. May be it had a problem with RAM.