Unity 6000.0.33: build Android get error "Modifying Android project files failed with output"

OS: Windows 10
Unity Version: 6000.0.33

When I build application in Android, arrears errors:

Modifying Android project files failed with output:
System.NullReferenceException: Object reference not set to an instance of an object
  at UnityEditor.Android.PostProcessor.ProcessModifyProjectFilesCallbacks.ModifyAndroidProjectFiles (AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs androidProjectFiles) [0x00b95] in <96672911ce664afea25a63cd59e554c0>:0 
  at UnityEditor.Android.AndroidBuildPostprocessor.ModifyAndroidProjectCallback (AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs args) [0x00001] in <96672911ce664afea25a63cd59e554c0>:0 
  at (wrapper delegate-invoke) System.Action`1[AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs].invoke_void_T(AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs)
  at Bee.BeeDriver.BuildRequest+<>c__DisplayClass63_0`1[T].<RegisterRPCCallback>b__0 (System.Object o) [0x00000] in <7d8d20144c904091b348a66cb66d50f4>:0 
  at Bee.BeeDriver.BeeDriver_RunBackend+<>c__DisplayClass1_0.<ProcessRPCRequest>b__0 () [0x00021] in <7d8d20144c904091b348a66cb66d50f4>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <ed969b0e627d471da4848289f9c322df>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <ed969b0e627d471da4848289f9c322df>:0 
--- End of stack trace from previous location where exception was thrown ---

  at Bee.BeeDriver.BeeDriver_RunBackend.ProcessRPCRequest (Bee.BinLog.RPCActionMessage msg, Bee.BeeDriver.BuildRequest+RPCCallback rpcCallback, IPCConnection ipcConnection, System.Threading.Tasks.Task writePipeConnectionTask, Bee.BeeDriver.InternalState state) [0x00102] in <7d8d20144c904091b348a66cb66d50f4>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

and

Build completed with a result of 'Failed' in 1060 seconds (1059749 ms)
Modifying Android project files failed with output:
System.NullReferenceException: Object reference not set to an instance of an object
  at UnityEditor.Android.PostProcessor.ProcessModifyProjectFilesCallbacks.ModifyAndroidProjectFiles (AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs androidProjectFiles) [0x00b95] in <96672911ce664afea25a63cd59e554c0>:0 
  at UnityEditor.Android.AndroidBuildPostprocessor.ModifyAndroidProjectCallback (AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs args) [0x00001] in <96672911ce664afea25a63cd59e554c0>:0 
  at (wrapper delegate-invoke) System.Action`1[AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs].invoke_void_T(AndroidPlayerBuildProgram.Data.AndroidProjectFileArgs)
  at Bee.BeeDriver.BuildRequest+<>c__DisplayClass63_0`1[T].<RegisterRPCCallback>b__0 (System.Object o) [0x00000] in <7d8d20144c904091b348a66cb66d50f4>:0 
  at Bee.BeeDriver.BeeDriver_RunBackend+<>c__DisplayClass1_0.<ProcessRPCRequest>b__0 () [0x00021] in <7d8d20144c904091b348a66cb66d50f4>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <ed969b0e627d471da4848289f9c322df>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <ed969b0e627d471da4848289f9c322df>:0 
--- End of stack trace from previous location where exception was thrown ---

  at Bee.BeeDriver.BeeDriver_RunBackend.ProcessRPCRequest (Bee.BinLog.RPCActionMessage msg, Bee.BeeDriver.BuildRequest+RPCCallback rpcCallback, IPCConnection ipcConnection, System.Threading.Tasks.Task writePipeConnectionTask, Bee.BeeDriver.InternalState state) [0x00102] in <7d8d20144c904091b348a66cb66d50f4>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Build Settings

How can I resolve this errors in Build of Unity?

Does this happen with empty project?

You could delete \Library\Bee folder, but not sure if it will help.

Not empty project. Project was updated from 2022.2.3f1

I deleted Library folder, rebuild project , but it not help me.

Content of folders inside Plugins

Plugins.rar (1.6 MB)



Project Settings/Player




I mean, can you try empty project and see if it works. If it works. We’ll need more info from project where it doesn’t work, can you also post Editor.log where it doesn’t work

empty project works and built on Android device

For now attach Editor.log.

But probably we’ll need a bug report with repro project to know for sure what’s happening.

Cheers

Editor1.zip (29.2 KB)

Not entirely sure, but could you try removing Notifications Package and see if that fixes the issue ?

If so, could you try building Empty Project with notifications package and see if it build correctly?

Did it. I removed Notifications Package and built project. Errors not fixed and appears again
I remove Library folder and build again, it’s not help me.

Editor1.zip (75.2 KB)

Without repro it’s hard to say, do you by chance have Android templates enabled?

Just wanted to let you know, we filled a bug internally, which will add symbol files for Android Editor extensions, this will add filenames + line numbers to the error stacktrace you’ve posted.

While it doesn’t help you directly, stacktrace with filenames + line numbers will help us better understand where the issue is happening

same error “Modifying Android project files failed with output:” on Unity 6000.0.45f appears again

Could you attach Editor.log, in that version Unity should print line numbers + files for the exceptions

Editor.zip (24.1 KB)

From log it feels like it fails when processing launcher/src/main/AndroidManifest.xml, do you have a template for this manifest set ?


templates for manifest

Android.zip (18.2 KB)

Sadly, Empty project + templates doesn’t reproduce the issue. We still need a repro project most likely. A long shot, but you could try :

  • Clone your project
  • Remove all assets except Assets\Plugins
  • And try to build to Android, if you’ll get NullreferenceException, submit a bug with this project.

Thank you

A long shot, but can you try changing windows display language to english?

remove folder Bee

and receive Errors again

Firstly, I create empty project with Unity 6000.0.45f, and download and install packages
(out Advertisment Legacy) as in repro project.



Project is built on Android and installed on Smartphone
It’s OK

Secondary, I add in project the package Advertisment Legacy with
Mobile Dependency Resolver
And project is not built.


Maybe, Advertisment Legacy has bug?