32

I have updated my android studio to new stable version 3.1. After build project not able to run.

Let me know if anyone have face same issue or find any solution.

My event log show this error

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Devganiya Hitesh
  • 1,207
  • 2
  • 17
  • 31

6 Answers6

30

Just go to "Run/edit configurations.../" and scroll down to bottom of the window and here you see an option "Before launch..." First, remove whatever already inside the little window and then click on (+) icon and select "Gradle-aware Make" and then type "assembleDebug" and select the first option or that you need. This will solve your problem.

msp
  • 3,272
  • 7
  • 37
  • 49
Chelo
  • 443
  • 4
  • 7
  • 3
    Both this and @erine [comment](https://stackoverflow.com/a/49521024/1009782) where helpful. I deleted both build folders and it worked. – Alex Mar 28 '18 at 07:04
  • 1
    This works for me. But could you please add a comment or link on what it actually does? To me it sounds like it is changing the may how it is built/assembled. – Erik Melkersson Mar 28 '18 at 18:46
  • both of the answer is not working for me. My classes are showing cannot resolve but the apk build is working. Android studio 3.1 and its killing me – Cyph3rCod3r Apr 02 '18 at 07:33
16

Try deleting both your build folders in your project manually and rebuild. This usually happens when you update gradle version, in my experience.

ernie
  • 350
  • 2
  • 10
9

The solution that worked for me was a combination of other answers here.

I had upgraded to the most recent stable version of Android Studio at the time, 3.1. Along with that, Android Studio prompted a dialog asking me if I wanted to upgrade my Gradle from 3.x to 4.4, and I accepted as well.

After that I got the error of this question, and then I did this:

  1. Open menu Run -> Edit configurations...
  2. In the Before launch: section, select any options you have listed (each option has the Android symbol), and remove them with the - symbol
  3. Add the option Gradle-aware Make, with the value assembleDebug
  4. Clean and rebuild your whole project
xarlymg89
  • 2,552
  • 2
  • 27
  • 41
2

just clean and rebuild your project

Hoby
  • 1,024
  • 12
  • 24
1

I had the same problem. I change in build.gradle 'compile' with 'implementation', then clean and rebuild the project. Now it starts with no problem.

Ionut
  • 11
  • 1
  • 2
0

Run "Build-> Clean Project" normally will fix this problem.