Search Unity

Bug Win32Exception at Resolving Android Dependencies , cannot find file gradlew.bat

Discussion in 'Android' started by Lukanto, Dec 27, 2022.

  1. Lukanto

    Lukanto

    Joined:
    Dec 19, 2022
    Posts:
    2
    I've added the Ads Mediation package to my project.
    With this, I've had to add the "Mobile Dependency Resolver" too.
    When the prompt: "Resolving Android Dependencies" opens, it keeps getting stuck at 0% and I get the following error message in the console:
    Win32Exception: Application Name= 'F:\UnityProjects\Test\Temp\PlayServicesResolverGradle\gradlew.bat', CommandLine='--no-daemon -b
    Native error= The System cannot find the file specified.
    I think it's the gradlew.bat file in question.
    However, when I'm looking up the folder, the file does indeed exist, but it doesn't have the .bat ending, it's simply named gradlew.
    When I'm changing the name manually to gradlew.bat, the Android Dependencies are being resolved until like 8%, but then it crashes with an other error: Resolution failed. Failed to fetch the following dependencies: com.ironsource.sdk:mediationsdk:7.2.6 and some other.
    I want to note, that I've installed the mediation tool via the unity package manager.
    How can I fix this?
     
    FamishedMammal and Hasan1192 like this.
  2. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    57
  3. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    57
    so apparently checking "Custom Main Gradle Template" and "Custom Gradle Properties Template" in publishing settings allowed it to resolve but had many errors on release build. After resolving, I unchecked them both then did a debug release and the apk built.
     
  4. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    57
    Code (CSharp):
    1. Win32Exception: ApplicationName='C:\Users\omitted\Temp\PlayServicesResolverGradle\gradlew.bat', CommandLine='--no-daemon -b "C:\omitted\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle" "-PANDROID_HOME=C:/Program Files/Unity/Hub/Editor/2021.3.16f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK" "-PTARGET_DIR=C:\omitted\Assets\Plugins\Android" "-PMAVEN_REPOS=https://android-sdk.is.com/;https://maven.google.com/" "-PPACKAGES_TO_COPY=com.ironsource.sdk:mediationsdk:7.2.6;com.google.android.gms:play-services-ads-identifier:18.0.1;com.google.android.gms:play-services-basement:18.1.0;com.ironsource.adapters:unityadsadapter:4.3.24;com.unity3d.ads:unity-ads:4.4.1" "-PUSE_JETIFIER=1" "-PDATA_BINDING_VERSION=4.0.1"', CurrentDirectory='C:\omitted\Temp\PlayServicesResolverGradle', Native error= The system cannot find the file specified.
    2.  
    3. System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <cb1c94a571d140989f59bc38dfed683a>:0)
    4. System.Diagnostics.Process.Start () (at <cb1c94a571d140989f59bc38dfed683a>:0)
    5. (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
    6. GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler, System.Boolean useShellExecution, System.Boolean stdoutRedirectionInShellMode) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
    7. GooglePlayServices.CommandLine.Run (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
    8. GooglePlayServices.CommandLine+<RunAsync>c__AnonStorey0.<>m__1 () (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
    9. System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <75633565436c42f0a6426b33f0132ade>:0)
    10. System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <75633565436c42f0a6426b33f0132ade>:0)
    11. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <75633565436c42f0a6426b33f0132ade>:0)
    12. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <75633565436c42f0a6426b33f0132ade>:0)
    13. System.Threading.ThreadHelper.ThreadStart () (at <75633565436c42f0a6426b33f0132ade>:0)
    14. UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)
    15.  
     
  5. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    57
    I decided to remove ironsource and go with google ad mob and within 10 minutes I had everything working with no issues or hackarounds. I have had nothing but headaches for the past 2 weeks trying to get everything working with ironsource. Worst migration and unity switch ever.
     
  6. dear123000

    dear123000

    Joined:
    May 25, 2020
    Posts:
    2
    It seems the dependencies needed to get IronSource running is nowhere to be found on any of the repo sources so the resolver can't download any of the packages. Super annoying.
     
    Noooaaahhhh and russellnadin like this.
  7. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    57
    If you look inside the Ironsource Files you will find the AWS download link to the resolver, The download link event itself is broken. You can copy paste the link. But I would advise to ditch Ironsource. I had some major issues day in day out.

    I switched over to Google Admob in 15 minutes and haven't had 1 issue since.
     
    russellnadin likes this.
  8. HASSANHR

    HASSANHR

    Joined:
    Feb 23, 2018
    Posts:
    18
    i'm having the same issue !!!!!!!! anyone fixed this?
     
  9. JasperRaccoon

    JasperRaccoon

    Joined:
    Feb 7, 2020
    Posts:
    1
    Apparently everyone is having this issue, including me, bruh...
     
  10. Glenvillepecor

    Glenvillepecor

    Unity Technologies

    Joined:
    Mar 17, 2022
    Posts:
    2
    Hello! We are looking into this issue now! What version of com.ironsource.sdk:mediationsdk are you using? I see this is an issue for 7.2.6, as shown by Lukanto. I have encountered this issue with 7.2.7. Will post an update here when I have more to update you all with.
     
  11. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    Hi Glen, has there been an update?
     
  12. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    Hi Glen, just circling back to see if there is an update.
    Thank-you
     
    SciCodeStudio likes this.
  13. Star_Maker

    Star_Maker

    Joined:
    Feb 2, 2016
    Posts:
    1
    How I managed to go through the installation without errors:
    • Completely clear the project from any attempted installations of the IronSource SDK (LevelPlay Mediation)
    • Close Unity and Unity Hub
    • Install latest version of Java JDK (version 19 at this time)
    • Set the JAVA_HOME Windows environment variable to "C:\Program Files\Java\jdk-19"
    • Launch Unity
    • Install the latest Google Android Dependency Manager unity package
    • Check "Custom Main Gradle Template" and "Custom Gradle Properties Template" in Player Settings > Publishing Settings
    • Install the latest version of the LevelPlay Mediation package
    After the installation insert the following lines to the "gradleTemplate.properties" file:
    Code (CSharp):
    1. android.useAndroidX=true
    2. android.enableJetifier=true
    You should now be able to build and use IronSource.
     
    Last edited: Feb 27, 2023
  14. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    Ok that got me a lot closer, now I'm getting errors on these dependencies failing to resolve. :mad:

    com.ironsource.adapters:unityadsadapter:4.3.24
    com.ironsource.adapters:applovinadapter:4.3.36
    com.ironsource.sdk:mediationsdk:7.2.7
     
  15. Hoorza

    Hoorza

    Joined:
    May 8, 2016
    Posts:
    45
    So many people seem to have problems with it. Including me. Why there is a new Ads package out anyway? Was Unity Ads wrong? Or is it about getting maximum ad sources in your game? I don't get it.
     
  16. SciCodeStudio

    SciCodeStudio

    Joined:
    Dec 14, 2013
    Posts:
    7
    Hi! I managed to solve this issue like this:

    1. Remove the IronSource SDK from your project (including the Mobile Dependencies stuff in the Assets/Editor directory, if you have something there)
    2. Install the latest External Dependency Manager (EDM) from google manually. You can go to https://github.com/googlesamples/unity-jar-resolver/tags and use the download link of the latest version there to get the .unitypackage. Currently that link is: https://github.com/googlesamples/un...ernal-dependency-manager-1.2.175.unitypackage
    3. Afterwards, add the Iron Source SDK again.

    Seems to me, like the EDM integration in the IronSource package is faulty.
     
  17. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    I tried your suggestion but I got the same problem.

    The steps I did was

    1. remove ironsource
    2. remove MobileDependencyResolver folder
    3. remove ExternalDependencyManager folder
    4. import that updated dependency manager from google that you linked
    5. import ironsource again

    I get hung up on the same dependencies failing to resolve.

    @DavidLiebermann Are you using the latest version of IronSource 7.2.7?
     
  18. SciCodeStudio

    SciCodeStudio

    Joined:
    Dec 14, 2013
    Posts:
    7
  19. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    Unfortunately that did not.

    What version of Unity are you using?
    I am on 2022.2.2f1

    Also did you do the custom gradle template and properties like the Star_Maker suggested?
    I enabled those settings as well.
     
  20. SciCodeStudio

    SciCodeStudio

    Joined:
    Dec 14, 2013
    Posts:
    7
    I'm using 2021.3.9f1.

    I've tried using a custom gradle template and properties, did not work for me. Maybe try disabling that?
     
    voporak5 likes this.
  21. voporak5

    voporak5

    Joined:
    Jul 1, 2013
    Posts:
    31
    Wow ok so yeah disabling custom gradle stuff fixed it!!!
    I turned those custom settings on initially because the resolver was complaining about the .bat
    However, getting the latest resolver package made that not required I guess.

    Now the question is, luckily I don't need this, but for someone who has to have custom gradle files how the heck are they supposed to get around this!

    Thanks a bunch David
     
    SciCodeStudio likes this.
  22. orreborre

    orreborre

    Joined:
    Feb 18, 2014
    Posts:
    21
    Been having the same problem, trying to get this working during the last couple of hours.
    I've decided to give up and try my luck with the Advertisement package instead.

    Unity 2021.3.19f1
    java --version: java 15 2020-09-15
    JAVA_HOME=C:\Program Files\Java\jdk-19.0.2

    Will keep an eye on this thread
     
  23. Glenvillepecor

    Glenvillepecor

    Unity Technologies

    Joined:
    Mar 17, 2022
    Posts:
    2
    Hello, sorry for the delay. If this is not working still for anyone, could you please link us a custom project / demo so we could look over the issues?
     
  24. MAttila

    MAttila

    Joined:
    Jun 9, 2015
    Posts:
    6
    It worked for me perfectly, thank you!

     
  25. Hddgames

    Hddgames

    Joined:
    Sep 27, 2016
    Posts:
    1
    It's worked for me... I Appreciate your work...Thanks for your solution.
     
  26. kingoftechnologyitech

    kingoftechnologyitech

    Joined:
    Dec 21, 2020
    Posts:
    1
    This sounds weird, but it worked for me,
    for those still having the same issue, try uninstalling the Ads package and delete the mobile package resolver and download the package without the resolver, I don't know why it works but it does
     
  27. SlothDogGames

    SlothDogGames

    Joined:
    Aug 17, 2021
    Posts:
    6
    Unfortunately none of the suggestions here have helped me solve my issue. same exact error but no progress.
    using
    2021/3/18f1
    Had nothing but headaches working with ironsource from the start. just as I'm about to build the release version of a game, I no longer can because of this error!
     
  28. Loving_Lover

    Loving_Lover

    Joined:
    May 21, 2015
    Posts:
    3
    Hello! Looks like a few of you have got this working. I am in the same boat as PlayerCake. :(
     
  29. Loving_Lover

    Loving_Lover

    Joined:
    May 21, 2015
    Posts:
    3
    Update:
    Installed fresh windows 11.
    Installed fresh install of Unity 2021.3.22f1.
    Tested my game on android. (Works perfectly).
    Installed Ads Mediation (Changed nothing else about my game).
    Got the Win32Exception error as mentioned above.
    Removed the Iron Source folder.
    Unity was able to switch to Android Build and export my APK.
    Transfered the APK to my test phone.

    The app now takes about 5 minutes to start up showing a black screen until the splash screen finally shows.
    I get much lower frames than I did before.
    I can't 'Build and Run' with my phone in dev mode like I used to. (before ads mediation).

    I guess that package is just busted?
    Any suggestions?

    I also tried what SciCodeStudio said, when I got to the step where I get the iron source SDK step, Unity goes back to the Win32Exception error.
     
  30. Loving_Lover

    Loving_Lover

    Joined:
    May 21, 2015
    Posts:
    3
    Has anyone found a good solution to the original issue that doesn't involve removing the iron source SDK?
     
  31. Andrew010110

    Andrew010110

    Joined:
    Oct 8, 2022
    Posts:
    18
    I was running into this and the issue is not that the extension is wrong, the issue is it is not downloading PlayServicesResolverGradle with the bat script. The gradlew without the .bat extension is a bash script which isn't guaranteed to work on Windows. I was able to get the correct script from here: https://github.com/googlesamples/un...e/AndroidResolver/scripts/gradle-template.zip

    It would be nice if the Ironsource Level Play package downloaded the proper version though as this is a really hacky workaround that gets cleared after an Editor restart as it lives in the temp folder and Unity mediation is pushing for Ironsource Level Play instead.

    Is there somewhere we can raise a bug report or get someone from Unity to get this fixed?
     
  32. aayushkafle183

    aayushkafle183

    Joined:
    Feb 3, 2023
    Posts:
    1
  33. paxron

    paxron

    Joined:
    Aug 22, 2014
    Posts:
    8
    Gosh its June and this is still a problem, manually adding the gradlew.bat file is useless as the temp folder gets cleared after closing the project. My resolution was to uninstall the mobile dependency resolver and Ironsource SDK, install the MDR from here and then install the Ironsource SDK.

    Tags · googlesamples/unity-jar-resolver (github.com)
     
    Last edited: Jun 15, 2023
    russellnadin likes this.
  34. CyberSherif

    CyberSherif

    Joined:
    Jan 19, 2021
    Posts:
    6
    None of the above solutions helped. i have to use legacy
     
  35. polskiebracie

    polskiebracie

    Joined:
    Jun 5, 2017
    Posts:
    2
    After several attempts, I found this answer and it finally worked! :D
    Thank you so much!
     
    SciCodeStudio likes this.
  36. russellnadin

    russellnadin

    Joined:
    Oct 26, 2022
    Posts:
    7
    July 18th 2023. The win32 error is still an issue when the Unity Mediation Package is being used. I don't know how to link a project for you but I have a screenshot showing the error. When mobile dependencies are resolved the win32 error appears and resolving is stuck at 0%

    I read about linking a project but I don't think this is what you were asking for.
    https://docs.unity.com/analytics/en/manual/LinkingYourProject
    With instructions I could learn to link a project.

    upload_2023-7-18_9-37-17.png
     
    Last edited: Jul 18, 2023
  37. Riz1n

    Riz1n

    Joined:
    Mar 22, 2014
    Posts:
    2
    I'm Also facing same issue anyone solved this issue? please guide us Thank You.
     
  38. Mainc51

    Mainc51

    Joined:
    Dec 22, 2020
    Posts:
    1
    I don't know if I fixed the problem definitively (I won't go too far) but switching to Unity 2022.3.0 and then starting the iron source install again, gradle didn't whine.
    I was on 2021.3.23 before.
     
  39. ChrisOneCrim

    ChrisOneCrim

    Unity Technologies

    Joined:
    Aug 17, 2023
    Posts:
    1
    Another workaround that worked for me is the second way aayushkafle183 shared:
    A. If you got stuck when you run "Assets > Mobile Dependency Resolver > Android Resolver > Resolve (or Force Resolve), open file explorer and move to "{YOUR_PROJECT_PATH}\Temp"
    B. Copy and backup "PlayServicesResolverGradle" folder to somewhere else.
    C. Download gradlew.bat file aayushkafle183 and copy it into the copied "PlayServicesResolverGradle" folder.
    D. Close Resolver window, and close Unity Editor, then restart Unity Editor to open your project again.
    E. Copy "PlayServicesResolverGradle" you have backed up in B into "{YOUR_PROJECT_PATH}\Temp"
    F. Run "Assets > Mobile Dependency Resolver > Android Resolver > Resolve"
    G. The resolution will be done.
     
  40. Grarafka

    Grarafka

    Joined:
    Aug 24, 2016
    Posts:
    3
    Why would Unity add a package that is obviously not working?
     
    GleyGames and Airman like this.
  41. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Same issue here...nothing helps...
    Trying to integrate Unity Ads using irounSource.
    Have done all the steps needed based on the docs and a couple of video tutorials.
    Trying for 3 days already !
    Moving gradlew.bat to Temp or Temp/PlayServicesResolverGradle also not helping !

    Just can't get iron source demo scene to work/build.
    Using Unity 2022.3.8f1 and IronSource 7.4.0

    // -----

    And just got this error after restarting because of setting up resolver again and can't open project anymore :p

    upload_2023-8-27_16-19-5.png

    This game engine is turning into quite a messy/useless thing for me :p

    For the last couple months i spend most of the time in forums looking for workarounds, reporting bugs, changing versions to see if issuses are fixed and what not... haven't done much valuable work ! Why i still waste time with it, just don't know :)
     
    Last edited: Aug 27, 2023
  42. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Last edited: Aug 28, 2023
  43. ertbaran

    ertbaran

    Joined:
    Feb 22, 2019
    Posts:
    11
    My Solution:
    • Open the project

    • Download this gradlew.bat file

    • Copy to this path: \ProjectFolder\Temp\PlayServicesResolverGradle
      (This path only avaible if project open)
    • Right click to Assets and Reimport
      (Save your project if you did any changes)
      upload_2023-9-9_15-11-26.png

    • Assets > Mobile Dependency Resolver > Android Resolver > Force Resolve
      upload_2023-9-9_15-15-43.png
    • AND DONE!
    Unity Editor: 2022.3.7f1
    IronSource version: 7.3.0
     
    Last edited: Sep 18, 2023
  44. jamesthewelsh

    jamesthewelsh

    Joined:
    Dec 4, 2015
    Posts:
    1
    My project is massive. Takes 25 minutes to reimport! I have to do this every time?
     
  45. StayUnity

    StayUnity

    Joined:
    Jul 26, 2020
    Posts:
    1
    I managed to solve the problem using the steps above additionally adding the latest gradlew version from https://services.gradle.org/distributions/ and by following this tutorial https://stackoverflow.com/a/76900605
     
  46. mattwood2855

    mattwood2855

    Joined:
    Nov 4, 2022
    Posts:
    4
    Its now the end of september and this still is a problem on an empty project on Windows 11. Its kind of pathetic.
     
  47. LashaBuxo

    LashaBuxo

    Joined:
    Feb 17, 2016
    Posts:
    2
    Why do developers publish versions that have not even passed some testing? It's really pathetic that unity does that and no one cares.
     
  48. SkillfulArthritis

    SkillfulArthritis

    Joined:
    Mar 20, 2023
    Posts:
    2
    Admob is not having somewhat the same issues as ironsource with their apk just making any game built with it crash repeatedly, so its not just a 10 minit init for them either...
     
  49. Leigh966

    Leigh966

    Joined:
    Mar 11, 2020
    Posts:
    2
    If you're looking to just give up on LevelPlay and use something else (which is what I'm doing):
    1. Close Unity + Unity Hub
    2. Open your project in File Explorer
    3. Search "IronSource"
    4. Delete everything that is found in the search

    It took me far too long to figure out how to get rid of this package just so I could have a working project again
     
    loaikk9 likes this.
  50. nathan2019spence

    nathan2019spence

    Joined:
    Jan 21, 2022
    Posts:
    19
    I wish we all could just go to paid apps only.