Search code examples
androidsingletonandroid-manifestdalvikandroid-multidex

Multidex And Singleton Class Uses android:name In The Manifest Application Tag


I have an application, and I used Singleton. And I just got 64k error. And I solve it, by compiling the dependencies and in the gradle - multiDexEnabled true

<application
    android:allowBackup="true"
    android:allowClearUserData="true"
    android:fullBackupContent="true"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:name="app.project.SingletonController"
    >

<!--android:name="android.support.multidex.MultiDexApplication"-->

Yet it says here in the same link, that in should be included in the Manifest -> <application android:name = "> The one that I commented above.

How do I get rid of this one?

The android:name="" will be duplicate and will produce error if I place it.


Solution

  • You're already defining a custom application class SingletonController for your app.

    MultiDexApplication is a simple utility class which you could use as super class for your own SingletonController. If for some reason this is not possible, you have to implement the functionality yourself

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }