[Fixed in 5.2.2p4/5.3] 5.2.1f1 APK fails to build with IndexOutOfRangeException

Hi folks,

I’m importing a Unity 4.6.8 project into 5.2.1 to test the waters, so to speak. Project compiles, plays, and builds successfully in 4.6.8 in 3 platforms (iOS/Android/WSA).

I’ve migrated the project, handled some plugins that were complaining, also fixed some scripts and the game plays as expected in the Editor. Project settings are kept the same as in 4.6.8.

However, whenever I tried to build an Android APK, I get the following error, and the build fails:

IndexOutOfRangeException: Array index is out of range.
UnityEditor.Android.PostProcessAndroidPlayer.CheckPluginsBundleIdForConflicts (System.String stagingArea, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

Here’s what I tried until now, but the error still persists:

  • to re-open the project in v 5.1
  • to create a new project and copy project files there
  • to download new Android sdks
  • to downgrade to v4 tools of android instead of v5
  • To delete the whole Library/ folder and re-import everything
  • To completely remove GooglePlayGamesPlugin-0.9.21 as suggested in another post

I’m really out of my wits here, this looks like a very unclear message and I’m not sure what it’s complaining about… Any ideas?

Thank you!

*EDIT: Updated with some more things that I’ve tried

I downgraded to 5.0.4f1 and the APK builds successfully.

It looks similar to an issue we had; I reported it as a bug (it was said to be fixed and will be available in a future release).
(are you on OSX as well ?)

Here’s my original email

Just wanted to bring this one to your attention (haven’t tried it on 5.3 yet, but it was reported on 5.2.1 so i assume it’s still there).

The issue happens when you set the bundle id for the game to lets say “com.TestGame.mygame”

and include an .AAR plugin with a similar package name, but different casing (e.g: “com.testgame.tools”

Some peeking into the code shows the issue, i think some string comparisons of looking up the folder names are case sensitive:

And the reply i received:

Thanks a lot for sharing! I’m on Windows 7 64-bit actually.

Our game’s bundle id is all lower case :confused: I’m wondering if indeed a plugin might be the culprit.

I’ll check it out and report back if I find out anything.

This issue has been fix, and the fix is already available in the latest 5.3 beta (beta 3): Unity Editor Beta Releases
It will probably be rolled to a patch release for 5.2 soon as well :slight_smile:

Thank you :slight_smile:

It has not made it in 5.2.2. Here’s hoping that it will make it in a patch,soon.

In 5.3 beta I can see it as:

  • Android: Buildpipe - Fixed IndexOutOfRangeException thrown on plugin package collisions
1 Like

They also fixed it in 5.2.2p4:

Thanks for the update! changing the title to reflect this.

1 Like