RSS

Android support multidex library implementation

25 Aug

By: Nicolas Tyler

There are a few things you have to do,

1- In your gradle you need to specify multidex and add the support library:

android {
    defaultConfig {
        ...
        multiDexEnabled true
        ...
    }
}

dependencies {
  ...
  compile 'com.android.support:multidex:1.0.0'
  ...
}

2- In your manifest you have to set your application to a multidex application:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package.name">
    <application
        ...
        android:name="com.package.name.my_application">
        ...
    </application>
</manifest>

3.1- In your application class you have to either extend MultiDexApplication:

public class my_application extends MultiDexApplication
{
    ...
}

3.2- Or Overide the attachBaseContext() method:

public class my_application extends Application
{
    protected void attachBaseContext(Context base)
    {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}

Copy from: http://stackoverflow.com/questions/26925264/android-support-multidex-library-implementation

Advertisements
 
Leave a comment

Posted by on August 25, 2015 in Android, Mobile Development

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: