Manuel Aiello
Manuel Aiello

Reputation: 1

Android Multidex issue

After upgrade to Android Studio 2.2 I have a problem with my app: Multidex 64k methods limit.

But, my app is a very simple app and it have only few libraries.

This is my gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.digitalborder.webappessentials"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 24
        versionName "2.2.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
}

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

    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.google.android.gms:play-services:9.6.1'
    compile 'com.google.firebase:firebase-core:9.2.0'
}

apply plugin: 'com.google.gms.google-services'

Can someone help me?

Thanks!

Upvotes: 0

Views: 505

Answers (2)

secret35
secret35

Reputation: 56

Please look at Android multidex doc

OR

You can try this code;

defaultConfig {
    applicationId "com.digitalborder.webappessentials"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 24
    versionName "2.2.2"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

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

compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.android.support:multidex:1.0.1'
}

and create new class

public class myApplicationClass extends Application{
   @Override
    public void onCreate() {
        MultiDex.install(getApplicationContext());
        super.onCreate();
    }
}

Upvotes: 0

Marcin Kunert
Marcin Kunert

Reputation: 6295

The cause of your issue is most likely play services:

compile 'com.google.android.gms:play-services:9.6.1'

If you really need the functionality try to pick a dedicated part of it. It has been split into several smaller libraries like:

com.google.android.gms:play-services-auth:9.8.0
com.google.android.gms:play-services-ads:9.8.0
com.google.android.gms:play-services-games:9.8.0

The full list is available here.

Upvotes: 1

Related Questions