CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
Where: Build file 'C:\Users\Nik\Downloads\Stu\Temp\gradleOut\launcher\build.gradle' line: 30
What went wrong: A problem occurred evaluating project ':launcher'. Could not get unknown property 'unityStreamingAssets' for object of type com.android.build.gradle.internal.dsl.AaptOptions.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Configure project :launcher WARNING: The option 'android.enableR8' is deprecated and should not be used anymore. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8. ] exit code: 1
Add this line to gradle.properties file:
unityStreamingAssets=.unity3d, google-services-desktop.json, google-services.json, GoogleService-Info.plist
Fixed it for me :)
As Chris said, you have put this at the bottom of your gradle.properties
file:
unityStreamingAssets=.unity3d, google-services-desktop.json, google-services.json, GoogleService-Info.plist
There's a few gotchas though:
If you don't have/can't find a gradle.properties
file:
Build Settings > Player Setttings > (Android Icon) > Publishing Settings
And look for Custom Gradle Properties Template
- if you see it checked, there's a .properties
file below it which is equivalent to your gradle.properties.
If you already have a unityStreamingAssets=
line:
You can combine the new line with your old one if you want to keep your old unitStreamingAssets tags; however you must put the line below **ADDITIONAL_PROPERTIES**
or it won't work!
Checkout the uaal-example example. One of the steps in the readme is to copy the gradle.properties
from the android export to your native app as one of those properties defines unityStreamingAssets
.
Copy gradle.properties file from exported Unity project root folder to native application root folder or create a symlink to make sure that this file is always up to date