IL2CPP does not work due to NDK (Unity 2019.2.0f1) - unity3d

I desperately need to build 64-bit of my application since Google Play does not accept 32-bit apps anymore. Mono builds just fine but when I switch to IL2CPP it says it can't locate NDK. However, NDK is automatically installed via **Unity Hub.**
I saw similar posts regarding to NDK in previous versions of Unity but I thought this would be fixed by now with latest Unity version. I have also tried to use a different NDK but I was still getting the same error.
Please help....

Check the Preferences dialog in the Unity Editor. It should have an option to provide a path to the Android NDK directory. There you can manually enter the path to the proper NDK installation location.

Well actually this turned to be related to MacOS version. On my other Mac, which is newer, the same Unity version detects NDK just fine.

The reason is that the NDK path being set automatically by Unity is wrong:
Unselect 'android NDK installed with Unity' in Unity Preferences. It will show the NDK Path. At the end of the path, you need to add:
/android-ndk-r16b
Check here for more details:
https://stackoverflow.com/questions...nable-to-locate-android-ndk/58241817#58241817

Related

Cant find Android NDK version 21.3.6528147 for unity 2022.1.10f1

I downloaded and installed unity 2022.1.10f1 using links found in :
https://unity3d.com/unity/whats-new/2022.1.10
I am developing for android using windows os,
so I downloaded both unity editor installers:
https://download.unity3d.com/download_unity/9aa0f82c4f96/Windows64EditorInstaller/UnitySetup64.exe
and android target support:
https://download.unity3d.com/download_unity/9aa0f82c4f96/TargetSupportInstaller/UnitySetup-Android-Support-for-Editor-2022.1.10f1.exe
but the problem is, android target support does not include android NDK required for building android apks.
to find what specific version of android NDK required for this release of unity, after launching Unity editor I went to: Edit -> Preferences -> External Tools tab, and I went down to: Android NDK section, unticked "Android NDK installed with unity (recommended), and It shows me the required version of NDK. which in this case is: 21.3.6528147 as shown in the photo here
Unity recommends that I download Unity SDK and all of its relaated modules using Unity Hub: https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe but there are sometimes when you have a limited internet package and you want to download offline installers for unity and modules so that you can re-install them if needed later on.
I looked on the internet for download link for that NDK version, but I can't find it.
I hope you can help.
Thank you
I found the link :
using Android Studio -> configure -> SDK Manager -> Android SDK -> SDK Tools, and then tick on "Show package details", then scroll down to "NDK (side by side)", and then tick on the required version. in my case: 21.3.6528147 as shown in the image bellow
and then press apply. It will bring you a confirmation screen, confirm it. then it will start downloading the file, and will show you a download screen like this screen:
now I can see the correct download link, which in this case is :
https://dl.google.com/android/repository/android-ndk-r21d-windows-x86_64.zip
I copied that link and stopped the downloaded. I used an external download manager to download the file and keep it offline. After the download had finished I extracted the file into a directory and set unity to look to that directory for Android NDK. as shown here:
This stopped me for some time, and I thought I should share it with you.
I hope it helps someone.
Thanks
For "Mac M1 Silicon" Download link for NDK (21.3.6528147) is https://dl.google.com/android/repository/android-ndk-r21d-darwin-aarch64.zip

Unity asking NDK version that is no longer available

The version of NDK Unity asking me to install is not on google site NDK Versions. The only one available is r19 version 19.2.5345600 but unity app is asking for r19 version 19.0.52321"
Image of the problem
Yeah, I know the problem can be solved by using Unity Hub but the reason I am not using that is because Unity Hub takes forever to download anything and my connection is slow. Unity Hub times out a lot and I have to install the entire unity 3D software and all of the external tools using it in order to download the NDK using Unity Hub. Currently, Unity doesn't allow you to add modules if Unity 3D is not downloaded using Unity Hub.
I have tried installing NDK r18 and r20 but that doesn't work, same problem.
So can anyone please help me?
You could try spoofing your NDK version, though this may cause unexpected behaviour. In Android ndk-r19c, modify source.properties such that:
Pkg.Desc = Android NDK
Pkg.Revision = 19.0.5232133
If you have Android Studio installed, (or can access via sdk manager, I guess )You can download the ndk version requested by Unity (r19 - 19.0.5232133) using the SDK manager.
Note: you have to uncheck the hide obsolete packages option

JDK, SDK, and Gradle errors trying to build a Unity game for Android

The question:
My environmental variable JAVA_HOME is set to the location of my manual installation of Java, so why is Unity claiming it is an invalid directory?
Supporting information:
I'm using Unity to build a game for Android phones with the intent on putting it on the Google Play Store for a client. We need to use a Google Ad plugin for managing ads in the game. However, when I put the plugin into the project I can no longer build the game.
When going to Assets > External Dependency Manager > Android Resolver > Resolve, it claims it succeeds.
But when I try Assets > External Dependency Manager > Android Resolver > Force Resolve or even building the project I get a failure and a perplexing error.
Originally I had the same problem as: Intellij Gradle terminal ERROR: JAVA_HOME is not set
When I tried the solutions there as well as following the steps at: https://javatutorial.net/set-java-home-windows-10
I've tried setting the environment variable both to the independent java installation as well as the location of Unity's JDK module and got an error that they were both invalid directories:
When I try to build I get the same error plus some additional errors:
I am unsure if the SDK error is related or not.
I already tried toggling these off and on, and even changing the installation targets to manual installations:
Possibly relevant information:
Using Unity 2019.3.0f6
InMobi Google Ads Unity Mediation Plugin Version 3.0.0
Windows 10 Pro
Java JDK 14.0.1
If Unity can't find JAVA_HOME it won't do anything, have you tried checking if you have that Environment Variable set correctly?
Check this thing.
Maybe you will need a Restart on you computer to see the changes.

Add android target to visual studio for Mac

I'm building over a non from scratch project, that a previous developer created in my office.
In a previous version of Unity - Visual Studio for Mac I generated some build for iOS, but now, with the newest version, I get this configuration:
Also, the configuration for Android is disabled.
How I can add Android as target for my project to generate an apk file?
UPDATE 1
VS Configuration.
UPDATE 2 / BUILD CONFING
Please refer to the following link to setup unity to make Android APK:
https://docs.unity3d.com/Manual/android-sdksetup.html
You will need to download: the latest version of java, and the android sdk.
You will need to set the unity path to the sdk
You will need to download and set up the android ndk.
Sounds like a lot of work but its really a lot of waiting. the Android SDK can take some time depending on which versions you wish to support and how far back you go.
Once you have followed the guide above you will be able to change your project to android in the project settings menu.
Good luck!
For mac users with unity looking to set up android:
Instructions for Mac
you should be able to select android here and then click switch platform...

Unable to list target platforms Unity 2018.1.0f2

I have a problem when i build / export my game into android's APK.
i've already replace latest tools folder to my SDK path but the problem still don't fixed.
So i tried to upgrade my Unity from 2017.2.0f3 into Unity 2018.1.0f2 and reconfigure my SDK path but still not working.
There's the error notice
Go through Unitys preferences and make sure android SDK Java SDK paths are configured. I had this error recently on a fresh install, the solution was to install https://developer.android.com/studio/releases/platform-tools ( also setting paths to platform tools in your system path can be useful while at it)