Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio hangs / Freezes when project build fails

I am experiencing a very wired problem since this evening.

If I have any errors in my android project, and build is failed, then my Android studio gets frozen / stuck. I cant do anything but kill the Android studio application. Even if I open the same project next time, gradle will try to build and freezes again. [Please find attached screen shot]

Only solution I could find is .... I have to find what exactly cause the "build fail" and I will have to resolve the issue using some other editor, and then my android studio will start working.

Thing is it was working without any issues till this evening; and suddenly broken down. Any one else having the same issue ??

-n

enter image description here

like image 726
Ninad Desai Avatar asked Dec 10 '14 13:12

Ninad Desai


3 Answers

If you are using Android Studio v1.2.1.1 or newer and you are using Macbook, I've recently seen that if your device is connected to your laptop (by usb have no idea about over the wifi) and you sleep your laptop then login again, Android Studio hang. Therefore, you need to unplug usb cable then you should see Android studio is happy and then reconnect your usb cable.

like image 108
Hesam Avatar answered Nov 02 '22 08:11

Hesam


Open your terminal and reset adb:

adb kill-server
adb start-server
like image 29
buxik Avatar answered Nov 02 '22 08:11

buxik


This is how I solved the same problem:

  • Go to your project directory using your terminal
  • run ./gradlew (or gradlew.bat) assembleDebug
  • Fix the problems reported by gradle
  • Restart android studio and the problem is gone
like image 10
barbarian Avatar answered Nov 02 '22 09:11

barbarian