有人可以帮我解决这个Gradle
(2.14.1)NullPointerException
错误,该错误在我的Android Studio(2.2)崩溃后开始出现。我是新手,所以我不知道如何解决这个问题。
我试过了:
我不知道还有什么可以解决这个问题。
这是gradle
控制台中--stacktrace
--debug
的错误:
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter]
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter]
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.NullPointerException (no error message)
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter]
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.NullPointerException
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.TreeSnapshotRepository.removeTreeSnapshotUsage(TreeSnapshotRepository.java:85)
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheBackedFileSnapshotRepository.remove(CacheBackedFileSnapshotRepository.java:47)
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1$1.run(CacheBackedTaskHistoryRepository.java:84)
08:33:16.858 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1.update(CacheBackedTaskHistoryRepository.java:66)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.afterTask(DefaultTaskArtifactStateRepository.java:135)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:68)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
08:33:16.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
08:33:16.860 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
08:33:16.861 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.Swapper.swap(Swapper.java:38)
08:33:16.862 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
08:33:16.863 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
08:33:16.864 [ERROR] [org.gradle.BuildExceptionReporter]
提前致谢。
答案 0 :(得分:0)
我在Android Studio / SDK上尝试过没有任何工作。
所以我不得不做手动路线。 I:
AndroidStudioProjects
目录并手动更改名称(刚刚添加" -backup"到目录名称的末尾); AndroidStudioProjects
目录,并将备份[project]\app\build.gradle
文件中的依赖项部分复制到新项目中的同一文件中; [project]\app\src\main
目录与旧项目中的所有内容复制到新项目中; Build > Rebuild Project
现在开始修复VCS ... -_-!
答案 1 :(得分:0)
确保如果您有local.properties,则实际存在sdk.dir和ndk.dir(如果已定义)的路径。在我的情况下,我的项目没有使用ndk,但是我的local.properties是从一个项目中复制的,并且ndk目录无效。我认为它不重要,但我下载并将ndk提取到local.properties的路径中,现在它可以工作了。我想我可以在local.properties中轻松评论/删除该行,但这不会有那么有趣.. :)