Can't build on Android AAPT2 Unexpected error during link

Hello everyone!

We have an issue with our game since we update Unity to 2020.3.Xf1 (16 & 24). When we want to build an APK to test, we have an issue with AAPT2 which failed for task :launcher:processReleaseResources while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade.

Here’s the error we have:

FAILURE: Build failed with an exception.  
What went wrong: Execution failed for task ':launcher:processReleaseResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-4.0.1-6197926-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

So apparently this should not happen…We already tried to :

  • Upgrade gradle version
  • Have custom gradle.properties with modified org.gradle.jvmargs for instance.
  • Export an Android Studio project
  • So many stuff…

We’re targeting API 30 and our Unity version uses gradle 6.1.1.

Thank you for your help and your time!

I have exactly the same error but my there is not much files/assets in my StreamingAssets folder(Assets/StreamingAssets). Should I check in another folder?

image

Holy Sh*t! Thank you so much, I hate unity so much sometimes. Not in a thousand years I would have checked Streamingassets.

Hi,

With some luck we found the issue, we had to many files in StreamingAssets folder…

For those with the same error it’s something to check :slight_smile:

Have a nice day!