'Error on Unity Android Build - Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0
This question have been asked before but I am looking for solution for Unity platform. I tried to export project , had it opened on Android Studio but Gradle sync failed there too.
I have been using GoogeAds and Firebase in my project. The project builds well for IOS but for Android it gives me error "Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0".
I tried to delete everything in Plugins folder (except Template.gradle) but still got the same error.
So neither I am able to debug it on Android studio nor it is building on Unity. Any help or direction will be very beneficial.
I am using unity 2018.4.5f1
Thanks
Solution 1:[1]
The problem here is that specific versions of Unity are tied to specific versions of gradle, and since later versions of gradle are not necessarily backward-compatible, you might not be able to build if you don't have the same one installed as your system-default version.
I solved this issue by making a reference to the internal versions of Java and gradle that Unity uses. For example, I was using Unity 2018.4.18 on a Mac for a recent project. This requires gradle 5.1.1, whereas my system gradle was 6.6. I noticed while building that it also used a number of command-line options.
So I just copied them into a new command:
alias gradle511='/Applications/Unity2018.4.18/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath "/Applications/Unity2018.4.18/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m"'
On Windows you could do something similar. For example, I found a copy of gradle at this location: C:\Program Files\Unity\Hub\Editor\2019.3.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib
Then, I could build by project successfully by finding the gradle project that Unity exported and running: gradle511 assembleRelease
Solution 2:[2]
Try to change dependencies { classpath 'com.android.tools.build:gradle:3.4.0'
to: dependencies { classpath 'com.android.tools.build:gradle:3.4.3'
... worked for me somehow
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Joseph |
Solution 2 | user18852612 |