firebase-unity-sdk
firebase-unity-sdk copied to clipboard
[Bug] Invalid mainTemplate.gradle for Unity 6000.0
Description
The gradle template for Firebase is not valid for Unity 6 and the upgrade process (whether Unity or Firebase) does not fix this.
The response from Unity can be seen in this Thread : https://forum.unity.com/threads/unity-6-preview-android-ndk-compatibility-issue.1589781/#post-9816465
The following line needs to be added:
ndkVersion "**NDKVERSION**"
Reproducing the issue
Take a project that works and builds for Android in 2023.2 or earlier.
Upgrade to 6000.0.1f1 and accept all of the defaults
Firebase Unity SDK Version
11.9.0
Unity editor version
6000.0.1f1
Installation Method
Unity Package Manager
Problematic Firebase Component(s)
Authentication
Other Firebase Component(s) in use
No response
Additional SDKs you are using
No response
Targeted Platform(s)
Android
Unity editor platform
Windows
Scripting Runtime
Mono
Release Distribution Type
Pre-built SDK from https://firebase.google.com/download/unity
Relevant Log Output
the main part is :
android.ndkVersion is [25.1.8937393] but android.ndkPath C:\Program Files\Unity\Hub\Editor\6000.0.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK refers to a different version [23.1.7779620].
The full trace can be seen here :
https://forum.unity.com/threads/unity-6000-0-1-android-gradle-errors.1591767/
If using CocoaPods for Apple platforms, the project's Podfile.lock
Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hey @runette, the ndkVersion "**NDKVERSION**" should already exists within the mainTemplate.gradle once the project is created. Not sure how it's missing in your gradle file.
Running Force Resolve should rectify this problem. There shouldn't be a need to manually edit this.
Hey @runette, the
ndkVersion "**NDKVERSION**"should already exists within themainTemplate.gradleonce the project is created. Not sure how it's missing in your gradle file.
As you can see from the relevant file from the Test Application I created for the other issue #1025 - The file created by the SDK in this project which was a clean build and I accepted all of the defaults - did not have that line
https://github.com/runette/Firebase_Test/blob/master/Assets/Plugins/Android/mainTemplate.gradle
Although - weirdly - the mainTemplate.gradle.backup file - that I think is created by the process that updates out of date entries in mainTemplate (e.g. compileSdkVersion => compileSdk ) DOES have that line. I am not sure if that process is yours or Unity's ?
https://github.com/runette/Firebase_Test/blob/6000/Assets/Plugins/Android/mainTemplate.gradle.backup
It looks a bit like edm4u has updated the entry and that other process has deleted it ??
I did try deleting that line from mainTemplate.gradle and then running Force Resolve and it did nothing.
That's really odd, let me do some more testing. Not sure if this is going to do anything different, but what happens if you delete the mainTemplate.gradle entirely then run Force Resolve? Somehow I think the Force Resolve might not be triggering for some reason.
I deleted all of the gradle files and ran Force Resolve and no joy but then I built the app and the correct (except for the problems in #1025 ) file was created.
I am going to close this bug - since my feeling is that the problem is Unity related and the fix is to delete the files.