

系统找不到指定的文件gradlew.bat
,4 个月前
发布于新手答疑
0
这个问题怎么解决 Win32Exception: ApplicationName='D:\unityXM\Myproject\Temp\PlayServicesResolverGradle\gradlew.bat', CommandLine='--no-daemon -b "D:\unityXM\Myproject\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle" "-PANDROID_HOME=C:\Users\pc\AppData\Local\Android\Sdk" "-PTARGET_DIR=D:\unityXM\Myproject\Assets\Plugins\Android" "-PMAVEN_REPOS=https://maven.google.com/" "-PPACKAGES_TO_COPY=com.unity3d.ads:unity-ads:[4.12.0,4.13[" "-PUSE_JETIFIER=0" "-PDATA_BINDING_VERSION=8.3.0"', CurrentDirectory='D:\unityXM\Myproject\Temp\PlayServicesResolverGradle', Native error= 系统找不到指定的文件。

System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <e243450672844c6f9f403082ca9f1be7>:0) System.Diagnostics.Process.Start () (at <e243450672844c6f9f403082ca9f1be7>:0) (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start() GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler, System.Boolean useShellExecution, System.Boolean stdoutRedirectionInShellMode) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0) GooglePlayServices.CommandLine.Run (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0) GooglePlayServices.CommandLine+<RunAsync>cAnonStorey0.<>m1 () (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0) System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ed969b0e627d471da4848289f9c322df>:0) System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ed969b0e627d471da4848289f9c322df>:0) System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ed969b0e627d471da4848289f9c322df>:0) System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ed969b0e627d471da4848289f9c322df>:0) System.Threading.ThreadHelper.ThreadStart () (at <ed969b0e627d471da4848289f9c322df>:0) UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)
175 次浏览
评论 0
1个回答
0
本回答由团结MuseChat(Beta)生成,请酌情参考。
这个错误通常是由于缺少gradlew.bat文件或路径配置错误引起的。根据搜索结果,有几种解决方案可以尝试:
- 手动创建gradlew.bat文件:
- 打开你的Unity项目。
- 导航到项目的Temp文件夹(只有在Unity活动时可见)。
- 创建一个新的gradlew.bat文件,内容如下:
@echo off setlocal set DIR=%~dp0 if "%DIR:~-1%"=="\" set DIR=%DIR:~0,-1% set GRADLE_HOME=%DIR% set DEFAULT_JVM_OPTS= set GRADLE_OPTS= set JAVA_OPTS= set CMD_LINE_ARGS= set CLASSPATH=%GRADLE_HOME%\lib\gradle-launcher-6.1.1.jar "%JAVA_HOME%\bin\java" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %CMD_LINE_ARGS% endlocal
- 检查路径配置:
- 确保路径配置正确,特别是ANDROID_HOME和TARGET_DIR等环境变量。
- 更新或重新安装External Dependency Manager (EDM):
- 从Google手动下载最新版本的External Dependency Manager(EDM)。
- 删除项目中的旧版本EDM,然后导入新版本。
- 禁用自定义Gradle模板:
- 在Unity的Player Settings中,取消勾选“Custom Main Gradle Template”和“Custom Gradle Properties Template”。
- 重新安装相关插件:
- 删除并重新安装所有相关的广告插件和依赖项。
希望这些方法能帮助你解决问题。如果问题仍然存在,请提供更多详细信息以便进一步诊断。
[1] Win32Exception at Resolving Android Dependencies , cannot find file gradlew.bat - Unity Engine - Unity Discussions https://discussions.unity.com/t/win32exception-at-resolving-android-dependencies-cannot-find-file-gradlew-bat/904380/21?page=2
[2] Gradle troubleshooting - Unity Manual https://docs.unity3d.com/es/2021.1/Manual/android-gradle-troubleshooting.html
[3] Win32Exception at Resolving Android Dependencies , cannot find file gradlew.bat - Questions & Answers - Unity Discussions https://discussions.unity.com/t/win32exception-at-resolving-android-dependencies-cannot-find-file-gradlew-bat/255959
[4] Troubleshooting the "gradlew: Command Not Found" Error: A Quick Guide for Developers - Learn IT University https://learn-it-university.com/how-to-fix-the-gradlew-command-not-found-error/
[5] I'm getting a Gradle error after installing the Ads Mediation package. - Unity Services - Unity Discussions https://discussions.unity.com/t/im-getting-a-gradle-error-after-installing-the-ads-mediation-package/947166
[6] Unity Gradle Build Failed: Causes and Solutions https://hatchjs.com/unity-gradle-build-failed/
[7] Error in a bat file - Help/Discuss - Gradle Forums https://discuss.gradle.org/t/error-in-a-bat-file/39690
,4 个月前回答
评论 0

问
AI
全新AI功能上线
1. 基于Unity微调:专为Unity优化,提供精准高效的支持。
2. 深度集成:内置于团结引擎,随时查阅与学习。
3. 多功能支持:全面解决技术问题与学习需求。

问
AI