How fix error :the number of method references in a .dex file cannot exceed 64K?
<p>I have included this point, it does not help solve the problem!</p>

<pre><code> multiDexEnabled true
</code></pre>

<p>Build.gradle</p>

<pre><code>    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.0'
    defaultConfig {
        applicationId "com.pokemongo.pokemon"
        minSdkVersion 16
        targetSdkVersion 24
    }
    buildTypes {
        release {
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.android.support:multidex:1.0.1'
}
</code></pre>

<p>Manifest:</p>

<pre><code>&lt;manifest package="com.pokemongo.pokemon"
xmlns:android="http://schemas.android.com/apk/res/android"&gt;
android:versionCode="1"
android:versionName="1.0"&gt;

&lt;uses-sdk
    android:minSdkVersion="18"
    android:targetSdkVersion="22" /&gt;

&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
&lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;

&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;

&lt;application
    android:allowBackup="true"
    android:icon="@drawable/pikachu"
    android:name="android.support.multidex.MultiDexApplication"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light"&gt;
    &lt;activity
        android:name=".CameraViewActivity"
        android:label="@string/title_activity_camera_view"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity android:name=".MapActivity"&gt;
        &lt;meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".CameraViewActivity" /&gt;
    &lt;/activity&gt;

    &lt;meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" /&gt;
    &lt;meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyD67YQ0A8XXPF5RvvtQIdJnc-gcqem5I9s" /&gt;

&lt;/application&gt;
</code></pre>

<p></p>

<p>Error:
<a href="https://i.stack.imgur.com/uctBy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uctBy.png" alt="enter image description here"></a></p>

<p>Logs:</p>

<pre><code>   Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2411Library
:app:prepareComAndroidSupportAppcompatV72411Library
:app:prepareComAndroidSupportMediarouterV72300Library
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportSupportV42411Library
:app:prepareComAndroidSupportSupportVectorDrawable2411Library
:app:prepareComGoogleAndroidGmsPlayServices940Library
:app:prepareComGoogleAndroidGmsPlayServicesAds940Library
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite940Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics940Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl940Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing940Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite940Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth940Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library
:app:prepareComGoogleAndroidGmsPlayServicesCast940Library
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework940Library
:app:prepareComGoogleAndroidGmsPlayServicesClearcut940Library
:app:prepareComGoogleAndroidGmsPlayServicesContextmanager940Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive940Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness940Library
:app:prepareComGoogleAndroidGmsPlayServicesGames940Library
:app:prepareComGoogleAndroidGmsPlayServicesGass940Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm940Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity940Library
:app:prepareComGoogleAndroidGmsPlayServicesIid940Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation940Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps940Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby940Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama940Library
:app:prepareComGoogleAndroidGmsPlayServicesPlaces940Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus940Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet940Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager940Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi940Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library
:app:prepareComGoogleAndroidGmsPlayServicesVision940Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet940Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable940Library
:app:prepareComGoogleFirebaseFirebaseAnalytics940Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl940Library
:app:prepareComGoogleFirebaseFirebaseAuth940Library
:app:prepareComGoogleFirebaseFirebaseAuthCommon940Library
:app:prepareComGoogleFirebaseFirebaseAuthModule940Library
:app:prepareComGoogleFirebaseFirebaseCommon940Library
:app:prepareComGoogleFirebaseFirebaseConfig940Library
:app:prepareComGoogleFirebaseFirebaseCrash940Library
:app:prepareComGoogleFirebaseFirebaseDatabase940Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection940Library
:app:prepareComGoogleFirebaseFirebaseIid940Library
:app:prepareComGoogleFirebaseFirebaseMessaging940Library
:app:prepareComGoogleFirebaseFirebaseStorage940Library
:app:prepareComGoogleFirebaseFirebaseStorageCommon940Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: D:\Android Project\Virtual\POKEMON\Pokemon\app\src\main\java\com\pokemongo\pokemon\CameraViewActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
&gt; com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 1 mins 6.756 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
</code></pre>