Skip to content

Fix Android Resolver unable to resolve mainTemplate.gradle in Unity 2022.2+ or 2023.1+ #547

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

Merged
merged 3 commits into from
Oct 3, 2022

Conversation

chkuang-g
Copy link
Collaborator

Android Resolver fails when mainTemplate.gradle is used in Unity 2022.2+ or 2023.1+

This is primary due to PlayServiceResolver.AndroidGradlePluginVersion property failed to find the the plugin version because the line is changed from

'com.android.tools.build:gradle:4.1.0'

to

id "com.android.application" version '7.1.0'

This fix make sure the property getter use both pattern to find the version number.

Later version of Unity (2022.2+ or 2023.1+) changed the way to specify
Android Gradle plugin version. As a result, `AndroidGradlePluginVersion`
getter would fail to find the version and Android Resolver would fail
when `mainTemplate.gradle` is in use.

This fix searches Android Gradle plugin version using two regex to
ensure Android Resolver can find the version in any Unity version.
@chkuang-g chkuang-g force-pushed the patch/gradle-plugin-version branch from e16268e to 6001cb4 Compare October 3, 2022 09:28
@chkuang-g chkuang-g merged commit 6d06c69 into master Oct 3, 2022
@chkuang-g chkuang-g deleted the patch/gradle-plugin-version branch October 3, 2022 15:53
@googlesamples googlesamples locked and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants