无法运行应用程序。 java.lang.NullPointerException(无错误信息)

时间:2021-05-26 08:00:18

标签: android android-studio gradle

我试图从 2016 年恢复一个非常非常古老的项目。在升级了 gradle 插件、gradlew-wrapper、数据绑定导入以及项目更新中引用的许多其他问题后,我能够运行该应用程序。但是当我尝试运行该应用程序时,我的构建因错误而中断:

java.lang.NullPointerException (no error message)

如果我使用 --stacktrace 选项运行相同的构建,我会得到这个:

java.lang.NullPointerException
    at org.gradle.internal.exceptions.DefaultMultiCauseException.printSingleCauseStackTrace(DefaultMultiCauseException.java:143)
    at org.gradle.internal.exceptions.DefaultMultiCauseException.printStackTrace(DefaultMultiCauseException.java:131)
    at org.gradle.internal.build.event.types.DefaultFailure.fromThrowable(DefaultFailure.java:56)
    at org.gradle.internal.build.event.types.DefaultFailure.fromThrowable(DefaultFailure.java:58)
    at org.gradle.internal.build.event.types.DefaultFailure.fromThrowable(DefaultFailure.java:58)
    at org.gradle.tooling.internal.provider.runner.ClientForwardingTaskOperationListener.toTaskResult(ClientForwardingTaskOperationListener.java:125)
    at org.gradle.tooling.internal.provider.runner.ClientForwardingTaskOperationListener.toFinishedEvent(ClientForwardingTaskOperationListener.java:91)
    at org.gradle.tooling.internal.provider.runner.ClientForwardingTaskOperationListener.toFinishedEvent(ClientForwardingTaskOperationListener.java:59)
    at org.gradle.tooling.internal.provider.runner.SubtreeFilteringBuildOperationListener.finished(SubtreeFilteringBuildOperationListener.java:96)
    at org.gradle.tooling.internal.provider.runner.SubtreeFilteringBuildOperationListener.finished(SubtreeFilteringBuildOperationListener.java:98)
    at org.gradle.tooling.internal.provider.runner.ClientForwardingProjectConfigurationOperationListener.finished(ClientForwardingProjectConfigurationOperationListener.java:73)
    at org.gradle.internal.operations.DefaultBuildOperationListenerManager$ProgressShieldingBuildOperationListener.finished(DefaultBuildOperationListenerManager.java:127)
    at org.gradle.internal.operations.DefaultBuildOperationListenerManager$1.finished(DefaultBuildOperationListenerManager.java:60)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$ListenerAdapter.stop(DefaultBuildOperationExecutor.java:170)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$BuildOperationTrackingListener.stop(DefaultBuildOperationRunner.java:229)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:82)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
    at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

但是问题还是没有搞清楚。

我已经试过了:

  • 删除我的项目中的 .gradle 目录
  • 删除.idea
  • 在我的电脑上删除 .gradle/caches 的整个安卓
  • 以上选项 + 使 cahces 无效并重新启动、重新导入项目、制作项目、同步项目、重新打开 Android Studio

所有这些选项都没有帮助我

0 个答案:

没有答案