26

I'm getting this error in Gradle in Android Studio:

:cart:transformClassesWithInstantRunForDebug FAILED
 Error:Execution failed for task  :cart:transformClassesWithInstantRunForDebug'.>
 java.lang.ClassNotFoundException: com.google.gsonhtcfix.JsonSyntaxException`

I am not able to run/execute my project in Android Studio. How can I resolve this issue?

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
RajeshVijayakumar
  • 10,281
  • 11
  • 57
  • 84

4 Answers4

71

Resolved :

Disable the Instant Run option in Android Studio 2.0 Preview

See this screenshot

RajeshVijayakumar
  • 10,281
  • 11
  • 57
  • 84
  • 2
    Perfect Answer, Works for me,, – Subho Mar 16 '16 at 13:21
  • 28
    This does not resolve the issue, only disables a potentially incredible feature of Android Studio. –  Apr 08 '16 at 14:55
  • 1
    I don't see your suggestion of how to fix it, Michael Herbig. And it does resolve the issue of the app not launching, of course it doesn't fix the broken IDE feature but nobody said disabling something fixes it. – A-Live Apr 28 '16 at 16:43
  • @MichaelHerbig Maybe it disables a great feature, but without disabling it I cannot debug! Now the question is, why we have to disable it and how to have a better solution – Csaba Toth May 30 '16 at 04:49
  • Thanks you! It's help me too – alekstim Sep 23 '16 at 08:32
  • 2
    -1 Then Instant Run doesn't work anymore and I have to wait ages for an app restart for the tiniest changes to become active. – AndreKR Oct 04 '16 at 07:55
  • app worked and android is so buggy! upgrading is more awefull – Hesham Yassin Feb 03 '17 at 14:13
  • I updated my Android Studio Gradle Plugin. And somehow I got that error. I tried many ways but did not get anyway work for my situation. finally i disabled the instant run setting. but What if I want to run instant run? – Gulnaz Ghanchi Sep 04 '17 at 06:28
  • Perfect Answer, this trick resolved my issue. Thanks my friend! – trejo08 Feb 10 '19 at 17:51
4

Something you can try is deleting the build folder. That does not always work but fixes it sometimes.

rm -rf cart/build

If that does not work. Run that command then in Android Studio select invalidate caches and restart.

Tony
  • 4,609
  • 2
  • 22
  • 32
1

This problem happen when the used gradle have problem with instant run.
So to solve this you have to either change gradle version or disable instant run.

Zacktamondo
  • 1,891
  • 3
  • 17
  • 33
0

In my nexus 5 I have get only warrning, but another devices not complied, so I have disabled debug mode if i need it /

buildTypes {
    release {
        debuggable false
        minifyEnabled true
        proguardFiles 'proguard-android.txt', 'proguard-rules.pro'
    }
    debug {
        debuggable false
        minifyEnabled false
        proguardFiles 'proguard-android.txt', 'proguard-rules.pro'
    }
} 
Vahe Gharibyan
  • 5,277
  • 4
  • 36
  • 47