googlesamples/unity-jar-resolver

[Bug] gradle modifications not compatible with gradle version latest Unity uses

idamaeng opened this issue ยท 12 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 6000.0.23f1
  • External Dependency Manager version: 1.2.83
  • Source you installed EDM4U: UPM (.unitypackage or Unity Package Manager)
  • Features in External Dependency Manager in use: All (Android Resolver, iOS Resolver, VersionHandler, etc.)
  • Plugins SDK in use: Firebase, Admob, Facebook, etc.
  • Platform you are using the Unity editor on: Mac (Mac, Windows, or Linux)

[REQUIRED] Please describe the issue here:

EDM4U adds following information to mainTemplate.gradle:

// Android Resolver Exclusions Start android { packaging { exclude ('/lib/armeabi/*' + '*') exclude ('/lib/mips/*' + '*') exclude ('/lib/mips64/*' + '*') exclude ('/lib/x86/*' + '*') exclude ('/lib/x86_64/*' + '*') } } // Android Resolver Exclusions End

This is not compatible with the gradle version Untiy is using. When triggering the build process Unity is complaining about this and converts this the snippet above to:

// Android Resolver Exclusions Start android { packagingOptions { exclude ('/lib/armeabi/*' + '*') exclude ('/lib/mips/*' + '*') exclude ('/lib/mips64/*' + '*') exclude ('/lib/x86/*' + '*') exclude ('/lib/x86_64/*' + '*') } } // Android Resolver Exclusions End

Which always creates a mainTemplate.gradle.backup files cluttering my project. Please adjust the plugin to use packagingOptions instead of packaging.

Thank you

This issue does not seem to follow the issue template. Make sure you provide all the required information.

This is a screenshot of the message:

Screenshot 2024-10-29 at 18 07 23

Hey @idamaeng, thanks for reaching out. It seems that the latest EDM4U 1.2.183 is already using the packagingOptions keyword.

lines.Add("android {");
lines.Add(" packagingOptions {");
foreach (var filename in sortedExcludeFiles) {

I wonder if it's being overwritten somewhere else. I tried using any Firebase products from the Firebase Unity Quickstart to test this but so far I'm getting the expected output.

mainTemplate.gradle

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/arm64-v8a/*' + '*')
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }

In this case, could you provide me a minimal reproducible example. Or perhaps steps how you were able to reproduce this behavior so I can investigate this further? Thanks a bunch!

Hey @idamaeng. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

Thaina commented

@argzdev I think the problem is opposite

We've detected that your custom Assets/Plugins/Android\mainTemplate.gradle file is using deprecated attributes such as packagingOptions. We can fix this automatically, your current mainTemplate.gradle file will be backed up. Continue?

It seem unity 6 was telling that packagingOptions should not be used. And ths popup instead changed into just packaging

image

Hey @Thaina, thanks for clarifying that. You're right. I did some research and it looks like the packaging was introduced in AGP 8.0+. Since Unity 6 uses AGP 8.3.0+, it should use this keyword instead.

I created a PR to fix this. Thanks!

Hi, the bug is closed but is still not released. Please make a release ;)

Any idea when a new release for this fix will be available?

Great! Thanks for working things out. Looking forward to an updated version of the plugin, because all these maintemplate backup files created over time are very annoying. Any chance to get an ETA when the fix will be available?

Hi all,

Sorry for the delay, a release is out that includes this fix, https://github.com/googlesamples/unity-jar-resolver/releases/tag/v1.2.184

@a-maurice using v1.2.184 I am running into the same message - unfortunately

Image

Downloaded the plugin from https://developers.google.com/unity/archive#external_dependency_manager_for_unity and installed it utilizing the package manager.

Am I the only when still receiving this message?

@idamaeng same here. I installed "external-dependency-manager-1.2.184.unitypackage" and I got the same message as yours. I'm in Unity 6.