gradle失败了"无法创建jna本地库" jndispatch.dll

时间:2014-06-27 11:21:57

标签: windows gradle

刚下载了zip的最新gradle 1.12版本并解压缩。 (C:\ DEV) 当我尝试使用

运行它时
c:\dev\gradle-1.12\bin>gradle

我失败了:

Build failed with an exception.

* What went wrong:
  Could not create JNA native library 'C:\projects\gradle_lib\native\jna\win32-x86\jnidispatch.dll'.

我之前曾在另一台机器上使用gradle,因此我家或二级主目录中可能存在一些隐藏的设置会污染我的gradle安装,但我对此表示怀疑。除此之外,我从未在c:\ projects中添加任何内容。

我在gradle-1.12,java 1.7.0_55,windows 7 enterprise SP 1上。

我不认为build.gradle是重要的,但我试图遵循spring.boot authentication example

刚刚下载的版本1.10对我来说已经有用了,但也给了同样的麻烦。

启用调试的完整堆栈跟踪:

gradle --debug build
12:57:54.089 [DEBUG] [org.gradle.internal.nativeplatform.services.NativeServices] Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to load native library 'native-platform.dll' for Windows 7 x86.
caused by: java.io.IOException: The system cannot find the path specified
12:57:54.118 [ERROR] [org.gradle.BuildExceptionReporter] 
12:57:54.120 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:57:54.120 [ERROR] [org.gradle.BuildExceptionReporter] 
12:57:54.121 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:57:54.121 [ERROR] [org.gradle.BuildExceptionReporter] Could not create JNA native library 'C:\projects\gradle_lib\native\jna\win32-x86\jnidispatch.dll'.
12:57:54.176 [ERROR] [org.gradle.BuildExceptionReporter] 
12:57:54.180 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
12:57:54.190 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.internal.nativeplatform.NativeIntegrationException: Could not create JNA native library 'C:\projects\gradle_lib\native\jna\win32-x86\jnidispatch.dll'.
12:57:54.191 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.nativeplatform.jna.JnaBootPathConfigurer.configure(JnaBootPathConfigurer.java:61)
12:57:54.193 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.nativeplatform.services.NativeServices.initialize(NativeServices.java:67)
12:57:54.193 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:30)
12:57:54.193 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:27)
12:57:54.193 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.logging.internal.OutputEventRenderer.attachConsole(OutputEventRenderer.java:68)
12:57:54.194 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(DefaultLoggingManager.java:146)
12:57:54.194 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:168)
12:57:54.194 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
12:57:54.195 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
12:57:54.195 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
12:57:54.195 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.Main.doAction(Main.java:46)
12:57:54.195 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
12:57:54.195 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.Main.main(Main.java:37)
12:57:54.196 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
12:57:54.196 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
12:57:54.196 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
12:57:54.196 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.FileNotFoundException: C:\projects\gradle_lib\native\jna\win32-x86\jnidispatch.dll (The system cannot find the path specified)
12:57:54.197 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.nativeplatform.jna.JnaBootPathConfigurer.configure(JnaBootPathConfigurer.java:51)
12:57:54.197 [ERROR] [org.gradle.BuildExceptionReporter]    ... 15 more
12:57:54.197 [ERROR] [org.gradle.BuildExceptionReporter] 

2 个答案:

答案 0 :(得分:0)

我的环境变量GRADLE_USER_HOME指向c:\projects\gradle_lib

答案 1 :(得分:0)

奇怪的是我的防病毒软件检测到jndispatch.dll文件不干净 有了它,它还检测到adb和avd文件为不洁净并将它们转储到其保险库中。

我不得不从AVG保险库中恢复它们。 配置AVG忽略(添加文件夹到例外列表)AndroidStudio文件夹和其他所需文件夹。

如果您没有防病毒并仍然面临此问题,请记住Windows 7及更高版本内置了'windows defender'。看看这个家伙是否在做同样的事情。将您的文件夹放在防病毒“排除”列表中,因为该供应商在全球范围内受到信任。

同样的答案会转到“Error in launching AVD with AMD processor”。我没有足够的声誉在那里和那里回答这个问题。