Gradle Error: Execution failed for task ':XY:transformClassesWithInstantRunForDebug' java.lang.ClassNotFoundException
<p>I've updated Android Studio from version like 1.1 to latest 2.2 and since then, I can no longer launch my application from Android studio. Which sucks!</p>

<p>When trying to run it on device, I get this gradle error (XY is the main project module)</p>

<blockquote>
  <p>Gradle Error: Execution failed for task
  ':XY:transformClassesWithInstantRunForDebug'. >
  java.lang.ClassNotFoundException:
  com.google.android.maps.MapController</p>
</blockquote>

<p>What is interesting, if I just "make" the project that means not running it, gradle finishes it task without complains. Also, Android studio doesn't show any error in the files where i am using com.google.android.maps.MapController like missing class etc.</p>

<p>And as I said, this appeared after I upgraded Android studio and that kind of sucks, if code stops working due upgrading of IDE! So now I have to either fix it, or again downgrade the IDE!</p>

<p>Please tell me, what could be the problem!</p>

<p>Btw this is the snippet of top level gradle file (build.gradle)</p>

<pre><code>dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
    classpath 'com.google.gms:google-services:1.5.0-beta2'
    classpath "com.newrelic.agent.android:agent-gradle-plugin:5.+"
}
</code></pre>

<p>Before i updated the AS the gradle line was like this:</p>

<pre><code>    classpath 'com.android.tools.build:gradle:1.3.0'
</code></pre>

<p>But new AS complained this is the old gradle version and forced to use 2.2.0, maybe the error is related to newer gradle version?</p>

<p>Also, i was thinking, that changing the line below in same file to either newer or older version could fix it, but i don't know which are the other options (simply i don't know from head what i could write there another and there is no selections of version)</p>

<pre><code>    classpath 'com.google.gms:google-services:1.5.0-beta2'
</code></pre>

<p>Btw, this is the snippet of gradle of main module XY:</p>

<pre><code>dependencies {
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'com.google.android.gms:play-services-location:8.3.0'
    ...
</code></pre>

<p>Anyone knows what is the problem? Please help, thanks.</p>