- Home /
enable multidex for android build
On building with Unity, I am getting an error:
trouble writing output: Too many method references: 78849; max is 65536.
You may try using --multi-dex option.
Similar to this post I am having issues with enabling multidex for android builds. I am extending MultiDexApplication with my own Application as follows:
import android.support.multidex.MultiDexApplication;
public class MyApplication extends MultiDexApplication {
}
and referenced from my AndroidManifest as follows
<application android:debuggable="true" android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:name="com.mycompany.MyGame.MyApplication">
But I can't figure out how to explicitly tell Unity to use multi dex. Again referencing this post, Liortal mentioned that Unity is "hard-wired" this way, and it cannot be resolved. I was wondering if this is truly the case? Does it require moving compilation out of Unity into Eclipse? Or can everything be done from inside Unity? If it can be done from Unity, how? Would proguard work better? Does that require moving into Eclipse also?
Anyone found a simple solution for this? Is it needed to build the android project, use Eclipse and mess with Gradle-settings etc..?
Answer by turdann · May 19, 2015 at 01:44 PM
No, I finally had to clean the project... taking off some big sdk's. I'd like to know another solution, but for the moment this is the best one.
Answer by BigToe · Nov 20, 2015 at 06:57 AM
Google changed their native play-game-services plugin to use AAR files instead of one huge .jar. This reduces the method calls and should allow you to build.
https://github.com/playgameservices/play-games-plugin-for-unity
Your answer
Follow this Question
Related Questions
Unity project wont build 0 Answers
Failed to compile Java code to DEX; Invalid command dx 0 Answers
why the application is opaque in android? 0 Answers
Temp Project Folder In Ramdisk Error 0 Answers
Using Pragma to slit app in two 1 Answer