Unity Android Support Setup JDK SDK NDK Gradle For All Versions
Unity Android Support Setup JDK SDK NDK Gradle For All Versions .
Unity Android Support Setup JDK SDK NDK Gradle
to can build game on unity you must setup jdk and sdk and ndk and gradle seperated not use default unity jdk and sdk and ndk and gradle and to do this follow this steps currectly .
1 - Download Java jdk
- for unity 2019 or 2020 or 2021 Download and Install Java JDK 8u77
after install jdk 1.8.0_77 copy java jdk path then unselect the box of unity jdk and paste the java jdk 1.8.0_77 path .
then Download and Install JDK 11
- after install jdk 11 go to unity then choose File then choose Build Settings then choose Player Settings then scroll down to Publishing Settings and in Custom Gradle Properties Template select the box .
- go to unity project folder then Assets Folder then Plugins Folder then Android Folder and right click on gradleTemplate.properties file and open it by any text editor .
in the first line of the gradleTemplate.properties file add this lineorg.gradle.java.home=C:\\Program Files\\Java\\
then go to jdk 11 folder in c then program files then java then copy jdk 11 folder name and add it in the end of first line of gradleTemplate.properties file like this
org.gradle.java.home=C:\\Program Files\\Java\\jdk-11
if you find this line android.enableR8=**MINIFY_WITH_R_EIGHT** comment it by add // in the first of line like this //android.enableR8=**MINIFY_WITH_R_EIGHT**
and save changes in the file . - for unity 2022 or 2023 or above Download and Install JDK 11
- after install jdk 11 go to unity then choose File then choose Build Settings then choose Player Settings then scroll down to Publishing Settings and in Custom Gradle Properties Template select the box .
- go to unity project folder then Assets Folder then Plugins Folder then Android Folder and right click on gradleTemplate.properties file and open it by any text editor .
in the first line of the gradleTemplate.properties file add this lineorg.gradle.java.home=C:\\Program Files\\Java\\
then go to jdk 11 folder in c then program files then java then copy jdk 11 folder name and add it in the end of first line of gradleTemplate.properties file like this
org.gradle.java.home=C:\\Program Files\\Java\\jdk-11
if you find this line android.enableR8=**MINIFY_WITH_R_EIGHT** comment it by add // in the first of line like this //android.enableR8=**MINIFY_WITH_R_EIGHT**
and save changes in the file .
2 - Install SDK
in ths article How to Download and Install SDK i explain how to download sdk and fix sdk problems .
3 - Download NDK
- for unity 2019 or 2020 Download NDK r19
- for unity 2021 Download NDK r21d
- for unity 2022 or 2023 Download NDK r23b
after download ndk extract it by right click and choose winrar program and choose extract here then open ndk folder and copy ndk folder path and unselect the box of unity ndk and paste ndk folder path .
4 - Download Gradle
- for unity 2019 or 2020 or 2021 or 2022 Download Gradle 7.6.2
- go to unity then choose file then choose Build Settings then choose Player Settings and scroll down to Publishing Settings and in Custom Base Gradle Template select the box .
- then go to unity project folder then Assets Folder then Plugins Folder then Android Folder then right click on baseProjectTemplate.gradle and open it by any text editor you will find version 7.2.1 or any version number change it to 7.0.3 then save changes in file . - for unity 2023 Download gradle 8.4
after download gradle extract it by right click and choose winrar program and choose extract here then open gradle folder and copy gradle folder path and unselect the box of unity gradle and paste gradle folder path .
Now it ready to build game choose File then Build Settings then Build button .
- to run game in android 11 or 12 or above follow this step : You uploaded an APK or Android App Bundle which has an activity, activity alias, service in Unity