Gradle problem when packing project

Working on Mac M1 with a VR project in UE 5.0.3 for Oculus Quest 2. As a Mac user I have to package the project each time I want to test it, and that has been working fine up until recent. I connected to source control and now there seems to be a problem with gradle when packing. Don’t know if this can be related in som way but I’m going nuts with trying to figure this out. This is the end of my output log:

UATHelper: Packaging (Android (ASTC)): > Task :app:packageDebug FAILED
UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
UATHelper: Packaging (Android (ASTC)): Execution failed for task ‘:app:packageDebug’.
UATHelper: Packaging (Android (ASTC)): > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
UATHelper: Packaging (Android (ASTC)): > java.lang.OutOfMemoryError (no error message)
UATHelper: Packaging (Android (ASTC)): * Try:
UATHelper: Packaging (Android (ASTC)): 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.
UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 1m 7s
UATHelper: Packaging (Android (ASTC)): 58 actionable tasks: 58 executed
UATHelper: Packaging (Android (ASTC)): ERROR: /bin/sh failed with args -c ““/Users/jensihlstrom/Documents/UnrealEngine/Stellan/Intermediate/Android/arm64/gradle/gradlew” :app:assembleDebug”
UATHelper: Packaging (Android (ASTC)): (see /Users/jensihlstrom/Library/Logs/Unreal Engine/LocalBuildLogs/Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 2m 25s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 1
PackagingResults: Error: Unknown Error

Using jre 8, and target ndk 21 (specific version ndk 21.4.7075529

Please help!