添加appbrain-sdk之后,Dex文件超过64k:14.30

时间:2018-08-14 11:42:50

标签: android firebase google-play-services

我正在将Appbrain广告SDK添加到我的应用gradle

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

现在我收到此错误:

错误:.dex文件中方法引用的数量不能超过64K。

我按照说明在代码中添加了multiDexEnabled true并得到了OutOfMemoryException

这是我的代码

我的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     

1 个答案:

答案 0 :(得分:0)

将此代码块添加到android块中的build.gradle中。

dexOptions {
    javaMaxHeapSize "4g"
}

代替

dexOptions {
        jumboMode true
    }

这应该可以解决您的问题。祝你好运。