On Unity 2019.2.15f1, MacOS Mojave 10.14.6
I opened a small project to test the integration of a few advertising SDKs.
After importing, cleaning and resolving a certain number of issues regarding Google’s resources, in part incurred because some SDKs still ship with the PlayServicesResolver (PSR) in Assets/ folder while others come with the newer ExternalDepedencyManager (EDM). The latter actually prompted me to be migrated to the package manager, so Unity “did stuff”, it downloaded, loaded and moved assets.
It appears to have been doing stuff related to Gradle too at some point after opening a window, loading a bar, so I let it run the course and finish whatever it was doing. All that being done, all seemed to work well and the EDM seemed to have superceded the PSR in the ‘Assets’ menu. I can’t even remember if I had to manually remove the PSR folder in Assets/ and perhaps some lingering related files in Plugin/ but, anyway, all was clean and apparently good to go.
So I pushed for a build and run on some Android device plugged into the computer.
In Build Settings;
I went for a development build.
With autoconnect profiler.
In Player Settings;
I targted API level 19 (4.4 “KitKat”) (I initially aimed lower but had plenty of androidx duplicate errors).
I aimed at two core types, ARMv7 and 64.
The scripting backend was IL2C++.
C++ compiler configuratio nwas “debug”.
The project is very small and I am not splitting binaries or using some kind of special package. I don’t use any Custom Gradle Template, neither do I use Proguard or minify anything. No custom keystore here either.
But the Gradle phase crashed after 4s and I got a pop up:
And then got a flood of errors in the console, because each “line” of information or suggestion is literally loaded as a separate error, which totaled into 86 red messages, even if the last messages actually contain all the former errors.
Here’s a selection of those I think are relevant here.
Let’s stop here already. First main problem seems to be related to Google Play Services here but a crucial information is lacking, something Gradle might not be able to compute.
I have a bunch of AndroidManifest files, but since the error is on line 83 of the merged file, I’m lost on how to know where to look at and actually what to look for.
Any suggestion?
Thank you Unity Console.
Follows a long list of DebugSource/Manifest/Resources/etc., CompileDebug, UP-TO-DATE or NO-SOURCE messages.
Then we’re back to what seems to be an important piece of science:
Here we go again with the special instructions lingo. I just want to compile stuff.
I know that when I prepared the project and succesively added SDKs, as said earlier, at some point a window popped up and there was plenty of stuff going on about Gradle.
Now for some reason, my test project seems to use some old Gradle features that are not compatible with Gradle 6.0.
There’s so little information and transparency about that Gradle wrapper/tool/thingy.
Here are some more errors:
I looked into Preferences, there was no warning regarding Gradle, aside from the warning one gets if one unticks any box; which is kinda odd to get these warnings as soon as a path is made visible.
I’d really love that the path leading the to DEFAULT tool (SDK, NDK, Gradle, else) would actually be displayed in gray.
The warning would only make sense if when unticking any of these boxes, it would display a path that is not the default one, but I think Unity should do an autoparse here, instead of automatically panicking about not using the proper version.
I also checked the Assets/ folder to see if I could find anything related to Gradle but besides one file proper to an advertiser’s SDK, there was nothing looking like a general config file or template whatever.
There’s an AndroidPlayer/Tools/GradleTemplate folder somewhere in Unity’s major folder elsewhere on the Mac but I’d rather not fiddle with that one (yet?).
Let it be known that there are no NDK elements installed in Android Studio’s SDK area. There are two elements, NDK (Side by side), and NDK (obsolete) and both are not installed.
So again, the main problem looks like it is about a version of Gradle. For some reason, an identification of the Gradle tools present on the computer is not done properly or something? Seems odd really, never had any issue before. Must be something else…
**
I noticed that I didn’t have a DISABLED mainTemplate.gradle file in my Assets/ folder.
It appeared after asking for a custom gradle template in Publishing settings and then setting it back to off (it adds the DISABLED extension).
Here is something strange though. Enabling or disabling this file doesn’t change the modification date (mine says late Dec 2019), as if it took the date of the template located elsewhere. That’s a small detail but it shouldn’t really behave that way nevertheless as the instance’s creation date should reflect when it was instantiated.
**
Well, since this file was instantiated into my Plugins/Android/ folder, I opened it to see if I could collect some information about the version of Gradle.
Ha. See this:
The information of value seems to be found in the line:
classpath ‘com.android.tools.build:gradle:3.4.0’
An old post but it’s suggested to change the line I highlighted.
Yet I don’t think I have the same issue. I’m not asked to upgrade Gradle, I’m only told that my project uses old functions.
Another poster said:
This is making me think that the problem might be in some manifest file, as per the first error I pasted here earlier on. All AndroidManifest.xml files are provided by ad SDKs in this simple test project.
Maybe Gradle is acting nuts because it’s lacking a piece of information?
To conclude, a last post I found on this topic:
This page suggests that it’s not recommended to manually upgrade Gradle and I’d agree, I’d rather not do anything like that.
Any 101-Dummies way I could use to obtain more information about this build failure?
The Console mentions using some special instructions. How am I to proceed exactly?