0

sorry for posting a new question about this, but since I have no rep, I cannot comment in the old question... and I must say, there is something in the code, I don't understand.

I'm currently developing a quiz app in Unity, and I've got quite a few SDKs and stuff, so Unity wont let me build for Android with single dex...

I'm no code gineus myself, but with the help of this post: Too many field references: 70613; max is 65536 I got the build working.

My question is now... can I add some code to Unity, that will get exported with the build project, so I don't have to add these lines of code everytime I make a new build? It is not a HUGE problem, but it would be nice to free myself from the future hassle.

Code in Android Studio

EDIT: Adding the code to MainTemplate.gradle works great if I just want to export to Android Studio and change the AndroidManifest.xml manually in there... but if I change the AndroidManifest.xml before exporting from Unity, then nothing works...

This is my original manifest:

<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:name="io.fabric.unity.android.FabricApplication">

In the direction part 2 it says:

2.Add android:name="android.support.multidex.MultiDexApplication" > to the application tag in the AndroidManifest.xml file.

Does "Add" mean add, or does is mean "change"?

<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:name="android.support.multidex.MultiDexApplication" >

??

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • You don't have to export the project to fix this problem anymore. See **FIX WITHOUT EXPORTING THE PROJECT** in that [answer](https://stackoverflow.com/questions/42582850/too-many-field-references-70613-max-is-65536) which shows how to fix this inside Unity without exporting the project. – Programmer Aug 14 '17 at 16:16
  • hmm... I tried this, but it did not work... Is this correct code: android:name="android.support.multidex.MultiDexApplication" > – Zyberchief Aug 14 '17 at 17:38
  • 1
    The direction on that answer is very clear. Just read and follow what's written there and don't just say "it doesn't work". You have to say what doesn't work.\ – Programmer Aug 14 '17 at 20:12
  • Right... so my question for you now is: Is the ">" correct in line 17 in https://pastebin.com/FFvn3BCL ? And I need to delete t´he original android:name, correct? – Zyberchief Aug 16 '17 at 10:29
  • It says on step 3 *"This is only for reference purposes. I suggest you don't use mine but instead follow the copy steps above to create yours because future Unity versions can come with different files."*. Do not use my xml or mainTemplate.gradle I linked there.It is there just to show you what it should look like. Follow step 1 and 2 to see where to get the original xml and mainTemplate.gradle files that you will have to modify. I will not be able to reply to your future post until you start following direction. – Programmer Aug 16 '17 at 14:00
  • Dear @Programmer, please look at my edit. As I told you, I'm no programmer myself, so I simply ask about the coding to get more insight. I have tried following the directions from top to bottom, and I've only worked on my own files, not copied the code directly from your files, so please try to level with me and explain me if the coding in your own file is correct or not. Should there be that many ">" marks? Should the "added" line of code be "added" or replace the existing android:name? – Zyberchief Aug 17 '17 at 15:29
  • You don't need to be a programmer to do this. You are only copying and modifying files. This is insane. You mean even with the screenshot I spend time taking and posting, you did not see the ">" there? What planet does "Add" mean "Change"? Add means include something, change means modify something....Anyways, you claimed to be following direction but your original Manifest is wrong. There should never be `android:name="io.fabric.unity.android.FabricApplication">` in the original Manifest. – Programmer Aug 17 '17 at 16:33
  • If you are using a plugin called "fabric" then this is a complicated matter as you [can't](https://stackoverflow.com/questions/28499424/multiple-application-androidname-tags-in-manifest) have two "android:name" in your app. See [this](https://stackoverflow.com/questions/42971043/using-fabric-with-multidex-with-an-exported-unity-project) for a possible solution. – Programmer Aug 17 '17 at 16:43

0 Answers0