"OutOfMemoryError: unable to create new native thread" after adding Google Play Services
<p>I am trying to implement an ad network's SDK and it requires me to add Google Play Services.</p>

<p>Now when I add <code>compile 'com.google.android.gms:play-services:9.6.0'</code> to my gradle file I get an error (see bottom). This might be due to some other libraries already installed, but I can't figure out how to fix the files.</p>

<p>Project gradle:</p>

<pre><code>buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
</code></pre>

<p>Module gradle:</p>

<pre><code>android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
}

dependencies {
    compile 'com.google.android.gms:play-services-appindexing:9.6.1'
    compile 'com.google.android.gms:play-services:9.6.0' // The new line
}
apply plugin: 'com.google.gms.google-services'
</code></pre>

<p>The error: </p>

<blockquote>
  <p>Error:Execution failed for task ':appName:mergeDebugResources'.
  java.lang.OutOfMemoryError: unable to create new native thread</p>
</blockquote>

<p>As said: without the new line, it runs perfectly.</p>