3

I was adding Appbrain Sdk for Ads to my app gradle

compile 'com.appbrain:appbrain-sdk:14.30'

Now I'm getting this error:

Error:The number of method references in a .dex file cannot exceed 64K.

I followed the instruction by adding multiDexEnabled true to my code and I get OutOfMemoryException

Here is my code

my app build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "com.webstore.footballscores"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 8
        versionName "1.7"
        multiDexEnabled true


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        jumboMode true
    }
    }

      dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])



    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.google.android.gms:play-services-ads:15.0.1'
    compile 'com.facebook.android:audience-network-sdk:4.23.0'
    compile 'com.google.firebase:firebase-core:16.0.0'
    compile 'com.google.firebase:firebase-iid:16.0.0'
    compile 'com.google.firebase:firebase-messaging:17.0.0'
    compile 'com.google.android.gms:play-services-analytics:16.0.0'
    compile 'com.google.android.gms:play-services-tagmanager:16.0.0'
    compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.startapp:inapp-sdk:3.9.3'
    compile 'com.appbrain:appbrain-sdk:14.30'


    testCompile 'junit:junit:4.12'
     }
     apply plugin: 'com.google.gms.google-services' 
       com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck=true     
Tito's
  • 73
  • 6

1 Answers1

0

Add this code block to your build.gradle in android block.

dexOptions {
    javaMaxHeapSize "4g"
}

instead of

dexOptions {
        jumboMode true
    }

This should solve your problem. Good luck.

rbd_sqrl
  • 420
  • 4
  • 14