-
Notifications
You must be signed in to change notification settings - Fork 363
[Bug] Android Gradle project repositories block don't work for the latest Unity versions #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue does not seem to follow the issue template. Make sure you provide all the required information. |
Hi @256p, Thanks for reporting this. Could you provide the |
Hi @paulinon, Here is xml:
I will try 2022.2.3f1 |
Hi @paulinon, I have managed to reproduce it with 2022.2.3f1
|
Sorry, I didn't copy the whole log. Here is full log:
|
Hi @paulinon, I just noticed that I haven't mentioned in the issue description the last step. You need to build a project for Android. Resolving isn't failing, the problem is the outdated Gradle script that EDM4U writes to the main template that crashes game build. |
Thanks for the additional input, @256p. I was able to reproduce the issue you're facing. Let me bring this up to the team. That said, I'll be marking this as a bug for now. |
i have a same issue. |
As a workaround while we look into this, you can try having Unity use an older Gradle plugin version by going to Preferences / External Tools and unchecking "Gradle installed with Unity (recommended)", then click Browse to locate an older Gradle plugin on your machine. Especially if you have an older Unity version installed, you can navigate to that version's Gradle plugin. |
Also, there is another workaround that keeps the Gradle version (in case some android lib requires it).
The conflicting part is
Now in Project Settings > Player > Publishing Settings for Android enable Custom Base Gradle Template
Now create
Now Gradle should build successfully. |
Followed 256p steps and it worked 100% thanks! |
inserting custom |
Thanks @256p Your solution worked perfectly! |
I have came across a similar error with different third party repository. Using @256p 's solution worked in Unity 2022.2.13. |
- Version 1.2.176 - Apr 27, 2023 * Android Resolver - Added two Android Resolver settings to determine whether EDM4U injects custom local Maven repo path as a relative path or full path. Fixes #537 * Android Resolver - Inject Maven Repo to `settingTemplate.gradle` from Unity `2022.2+` Fixes #594 * Android Resolver - Jetifier option is enabled by default now. * Android Resolver - `Explode Aar` option applies to all cases, whether the project will be exported or not. Fixes #584 Fixes #287
- Version 1.2.176 - Apr 27, 2023 * Android Resolver - Added two Android Resolver settings to determine whether EDM4U injects custom local Maven repo path as a relative path or full path. Fixes #537 * Android Resolver - Inject Maven Repo to `settingTemplate.gradle` from Unity `2022.2+` Fixes #594 * Android Resolver - Jetifier option is enabled by default now. * Android Resolver - `Explode Aar` option applies to all cases, whether the project will be exported or not. Fixes #584 Fixes #287
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)
Steps to reproduce:
<repository>
specified.Expected:
Successful build
Observed:
A lot of warnings from Gradle like that:
And this error:
You can use this project for testing: https://github.com/256p/unity-jar-resolver-custom-template.git
The reason behind this is that some time ago Unity switched to the new Android Gradle Plugin version (7.1.0). In this version repository setting was moved from the top-level
build.gradle
file to thesetting.gradle
(release notes: https://developer.android.com/studio/past-releases/past-agp-releases/agp-7-1-0-release-notes#settings-gradle). But EDM4U still addsproject.repositories
block in the main gradle template which will not work ifsettings.gradle
hasdependencyResolutionManagement
block.As I see there are several possible solutions:
IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject
and modify settings.gradle after every build.settingsTemplate.gradle
automatically and add repositories there instead of the main gradle template.settingsTemplate.gradle
and then generate a repositories list there. But Unity doesn't provide a checkbox for the settings template (which is quite odd), which means that the user will need to copy the correct template fromPlaybackEngines/AndroidPlayer/Tools/GradleTemplates/
.Please answer the following, if applicable:
What's the issue repro rate? 100%
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.
The text was updated successfully, but these errors were encountered: