发布于 5年前

【Android Studio 3.0 Beta】Gradle同步报NullPointException

问题

Android Stuido 3.0 alpha 升级到 Android Studio 3.0 beta,gradle 同步之前的项目错误:

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)

解决方法

有两种方式:命令行方式和IDE交互方式

命令行方式

Windows

gradlew clean
gradlew assemble

Linux/Mac

./gradlew clean
./gradlew assemble

Android Studio IDE方式

Build > Clean Project
©2020 edoou.com   京ICP备16001874号-3