I’m encountering an issue with the NDK version compatibility. Everything runs smoothly with Unity version 2023.2.4f, including successful builds. However, upon switching to Unity 6 preview, the build process halts without any errors, citing an NDK version mismatch.
Despite not altering the NDK configuration, I’ve consistently relied on the versions bundled with Unity’s SDK and JDK during installation. Interestingly, attempting to build with Unity 6 preview prompts a requirement for NDK version 25.1.8937393, whereas version 2023.2.4f functions seamlessly without such constraints.
Upon investigating further, Unity specifies support solely for NDK version 23.1.7779620, making it impossible to proceed with an alternate NDK version.
I have been facing Android build issues after upgrading to Unity 6000.0.0f1. I’m using versions installed with Unity.
First I had compilation error indicating that namespace was missing from build.gradle.
android {
namespace “com.your.package.name”
…
}
After I added it to mainTemplate.gradle I’m now getting:
[CXX1100] android.ndkVersion is [25.1.8937393] but android.ndkPath C:\Program Files\Unity\Hub\Editor\6000.0.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK refers to a different version [23.1.7779620]
Thanks, after re-creating the template(s) I didn’t need to edit template myself. But now I’m getting following error which is not directly related to Unity since it’s coming from adb.exe but these android tools are shipped with Unity 6.
I tested running the same adb.exe command using Administrator command prompt and it gives the same error.
OS Name Microsoft Windows 11 Enterprise
Version 10.0.22631 Build 22631
CommandInvokationFailure: Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
C:\Program Files\Unity\Hub\Editor\6000.0.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe -s “ba421876” shell pm list packages “com.my.package.name”
stderr[
Exception occurred while executing ‘list’:
java.lang.SecurityException: Shell does not have permission to access user 10
com.android.server.am.ActivityManagerService.handleIncomingUser:14235 android.app.ActivityManager.handleIncomingUser:4748 com.android.server.pm.PackageManagerShellCommand.translateUserId:3728
at com.android.server.am.UserController.handleIncomingUser(UserController.java:2710)
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:14235)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:4748)
at com.android.server.pm.PackageManagerShellCommand.translateUserId(PackageManagerShellCommand.java:3728)
at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:1063)
at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:959)
at com.android.server.pm.PackageManagerShellCommand.runList(PackageManagerShellCommand.java:792)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:234)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6823)
at android.os.Binder.shellCommand(Binder.java:1092)
at android.os.Binder.onTransact(Binder.java:912)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4352)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6807)
at android.os.Binder.execTransactInternal(Binder.java:1392)
at android.os.Binder.execTransact(Binder.java:1299)
]
stdout[
Yes, it seems to be related to device and permissions to install/uninstall the APK. Just wondering what happened with version update, since previously I was able to deploy to this particular device just fine. I’m able to deploy to my other Android device and will try to get that other one working too. Thank you.
Solution works for me
delete custom main gradle template
also delete backup gradle template file if it is created.
then again check custom gradle template file and then make a build
if not work then do next step is goes to EDM settings and resolve android then make build.
if work only for ndk mismatch version.