Build Error : Failed to call IPostGenerateGradleAndroidProject callback

Hi,

I suddenly got this error while building on an Oculus Quest 2.

Failed to call IPostGenerateGradleAndroidProject callback

Does anyone have a clue of how it appeared, or how it can be solved ?

Thank you.

8424408--1114992--Capture d’écran 2022-09-08 à 11.11.58.png

What unity version?
Does a blank project work?

I’m on version 2021.2.13f1, and a blank project does not work neither.
I tried reinstalling all Android build support, JDK… but it still does not build.

The same project, on the same Unity version builds on another computer.

Then I suggest reinstalling unity, and unity hub both fully.
Might as well go to the 2021 LTS if possible in the meantime

Same here… Testing with 2022.2.7f1 and 2022.2.9f1. I just imported the Oculus Integration 49, done all the recommended settings. My scene only has an OVRCameraRig… and it does that same error.

The same project, on the same Unity version builds on another computer.
me too

Me too, did you solve the problem?

Me too, did you solve the problem??

Me too, did you solve the problem??
EDIT :- I solved solution is down in the same thread written by me :slight_smile:

I am facing the same issue, any progress ?

There’s not a lot of information to go on here. Can you submit a bug? That will give us a lot more to work with.

1st i will suggest u to try building ur game on a stable network connection in my case my wi-fi was not stable so i tried building it on my mobile data (through hotspot) if it still fails then try these steps

1. Check if the SDK Path Has Read-Only Attributes:

  • Right-click the SDK folder again and select Properties.
  • Under the General tab, see if Read-only is checked. If it is, uncheck it and click Apply.
  • You may need to apply this change to subfolders as well.

2. Run Unity as Administrator:

  • Sometimes, Windows requires administrative privileges to access certain folders fully.
  • Close Unity, right-click on the Unity executable (or shortcut), and select Run as administrator.
  • Open your project and check if the error persists.

3. Check Permissions on Subfolders:

  • Permissions may need to be manually set on specific subfolders, especially platform-tools, tools, and build-tools.
  • Go into each of these folders, right-click, select Properties > Security, and ensure your user has Full control.

4. Reinstall the SDK or Update SDK Path:

  • In some cases, the SDK installation may have become corrupted. You can try:
    • Reinstalling the SDK: Remove the current SDK folder and download a fresh version from Android Studio or the command line tools, then update the SDK path in Unity.
    • Updating the SDK Path in Unity: After reinstalling, go to Edit > Preferences > External Tools and manually set the SDK path to the newly installed location.

5. Clear and Refresh Temp and Cache Files:

  • Unity may still hold onto temporary or cached files causing issues. You can:
    • Delete the Library and Temp folders in your project directory. These will be regenerated the next time you open Unity.
    • Go to Edit > Preferences > External Tools in Unity and click Regenerate Project Files.

6. Environment Variables:

  • Ensure your Android SDK path is correctly set in your Environment Variables:
    • Go to System Properties > Environment Variables.
    • Under System variables, find or create a variable called ANDROID_HOME and set its value to your Android SDK path.
    • Restart your computer to apply changes.

7. Verify Unity and SDK Compatibility:

  • Make sure you’re using an SDK version compatible with your Unity version. Sometimes, SDK updates are incompatible with older Unity versions, so it’s worth verifying on Unity’s documentation or downgrading the SDK.

Got it resolved, it because of the android version limit and difference.
Thanks for the help.
Forgot to update.

Follow this exact procedure rather watching an Youtube videos.