Gradle 升级到 Android Studio 3.0 Beta 1 时出错

Gradle error upgrading to Android Studio 3.0 Beta 1(Gradle 升级到 Android Studio 3.0 Beta 1 时出错)
本文介绍了Gradle 升级到 Android Studio 3.0 Beta 1 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

注意:这似乎是 Android 插件的问题.查看相关问题的评论.

Note: This seems to be an issue with the Android plugin. See comments for associated issues.

我在构建项目时收到以下 gradle 错误:

I get the following gradle error when building the project:

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)
            ...

我还要注意,我必须手动设置 jdk 位置,因为如果我使用捆绑的 gradle 守护程序将不会启动,抱怨不在预期的上下文中(它期待捆绑的上下文,而不是获取外部上下文).

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).

此配置在 Canary 9 中有效(使用捆绑的 jdk).

This configuration worked (with the bundled jdk) in canary 9.

推荐答案

感谢@Grsmto

根据这篇博文你需要打开一个终端并依次启动以下命令:

As per this blog post you need to open a terminal and launch the following commands sequentially:

更新

现在解决方法更简单了,您只需要转到 Build ->清理项目,然后同步.

Now the workaround it's easier, you just need to go to Build -> Clean Project and then sync.

Windows

gradlew clean

gradlew assemble

Linux/Mac

./gradlew clean

./gradlew assemble

然后同步项目.

这篇关于Gradle 升级到 Android Studio 3.0 Beta 1 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
cocos2d-android: how to display score(cocos2d-android:如何显示分数)
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
Android file copy(安卓文件拷贝)
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)