Gradle错误升级到Android Studio 3.0 Beta 1 [英] Gradle error upgrading to Android Studio 3.0 Beta 1
问题描述
构建项目时出现以下gradle错误:
Gradle同步失败:原因:java.lang.NullPointerException $ b $ sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)$ b $ sun.nio.fs.WindowsPathParser .parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255 )
在java.nio.file.Paths.get(Paths.java:84)
在com.android.build.gradle.internal.scope.BuildOutput.getOutputPath(BuildOutput.java:222)
at com.android.build.gradle.internal.scope.BuildOutputs.lambda $ load $ 2(BuildOutputs.java:243)
at java.util.stream.ReferencePipeline $ 3 $ 1.accept(ReferencePipeline.java: 193)
在java.util.ArrayList $ ArrayListSpliterator.forEachRemaining(ArrayList.java:1376)
在java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
在java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
在java.util.stream.ReduceOps $ ReduceOp.evaluateSequential(ReduceOps.java:708)
...
我会记下此外,我必须手动设置jdk位置,因为如果我使用绑定的那个,gradle守护进程将不会启动,抱怨没有处于预期的上下文环境中(它期望绑定的上下文,而是获取外部上下文)。
这个配置在金丝雀9里工作(与捆绑的jdk)。
感谢@Grsmto按照这篇博客文章,您需要打开一个终端并按顺序启动以下命令:
更新
现在解决方法变得更简单了,您只需转到 Build - > Clean Project ,然后同步。
Windows Linux / Mac 然后同步项目。 Note: This seems to be an issue with the Android plugin. See comments for associated issues. I get the following gradle error when building the project: I will note additionally that I had to set the jdk location manually because if I used the bundled one the gradle daemon would not start, complaining of not being in the expected context (it was expecting the bundled context, instead getting the external context). This configuration worked (with the bundled jdk) in canary 9. Credit to @Grsmto As per this blog post you need to open a terminal and launch the following commands sequentially: UPDATE Now the workaround it's easier, you just need to go to Build -> Clean Project and then sync. Windows Linux/Mac then sync the project. 这篇关于Gradle错误升级到Android Studio 3.0 Beta 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
gradlew clean
gradlew assemble
./ gradlew clean
./ gradlew assemble
Gradle sync failed: Cause: java.lang.NullPointerException
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.build.gradle.internal.scope.BuildOutput.getOutputPath(BuildOutput.java:222)
at com.android.build.gradle.internal.scope.BuildOutputs.lambda$load$2(BuildOutputs.java:243)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1376)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
...
gradlew clean
gradlew assemble
./gradlew clean
./gradlew assemble