2

I have a very similar issue as discussed here: Using Fabric with Multidex with an exported Unity project

Both Fabric and Multidex (for older Android versions) require adding an Application subclass to the AndroidManifest.xml file's application tag. But I can't include both without error, and I don't have access to either of these classes in order to modify them and alter the inheritance hierarchy.

(I need both of these together.)
<application ... android:name="android.support.multidex.MultiDexApplication">
<application ... android:name="io.fabric.unity.android.FabricApplication">

Our build uses Gradle (fairly newly supported in Unity) if that opens any avenues.

How can I get around this issue? I'm open to decompiling and rebuilding jars but so far all my efforts to decompile the fabric-init.jar (which contains the Application subclass) have failed.

vargonian
  • 3,064
  • 3
  • 27
  • 36
  • 1
    I find this to be a dup. It looks like you are having the "too many field references* problem and want to enable Multidex for this reason. Another solution is to use ProGuard as suggested from the other answer in [this](https://stackoverflow.com/q/42582850/3785314) question. If ProGuard does not reduce it enough then continue with your Multidex solution. – Programmer Aug 23 '17 at 22:22
  • We are at the point at which we've trimmed all we can and we are making the switch to Multidex. My issue isn't simply "how to enable multidex", it's "how to enable multidex in a Unity Android project that also uses Crashlytics--or Fabric". The problem is that enabling both of these cause conflicts with the implementation of the other. – vargonian Aug 24 '17 at 14:30
  • Ok I am just making sure that you have tried using ProGuard. – Programmer Aug 24 '17 at 15:45

1 Answers1

1

You can use the custom Application class with next content:

protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    // this one is needed to enable multidex in your application
    MultiDex.install(this);
}

public void onCreate() {
    super.onCreate();
    // this one is needed to init the Fabric SDK
    FabricInitializer.initializeFabric(this, FabricInitializer.Caller.Unity);
}

Also, one more solution you can check here, I created a small GitHub repo with description how to make it in few clicks.

Orest Savchak
  • 4,529
  • 1
  • 18
  • 27