Стандартный шаблон LibGDX NullPointerException - PullRequest
0 голосов
/ 19 мая 2018

Я только что создал новый проект LibGDX и импортировал его в Android Studio 3.0 с Gradle 4.6, включая модули Desktop, android и IOS.Android работает нормально, но рабочий стол выдает NullPointerException, и я понятия не имею, почему.Вот полная трассировка стека.

Error:Gradle: 07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.NullPointerException (no error message)
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.241 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
07:14:50.242 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.NullPointerException
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.BasePlugin.lambda$configureProject$1(BasePlugin.java:436)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.sun.proxy.$Proxy68.graphPopulated(Unknown Source)
07:14:50.243 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:128)
07:14:50.246 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
07:14:50.247 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
07:14:50.247 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
07:14:50.247 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:336)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:210)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:140)
07:14:50.248 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:53)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
07:14:50.249 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.250 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.util.Swapper.swap(Swapper.java:38)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
07:14:50.251 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2m 31s

Я добавил следующие строки в класс Desktop, поскольку в другом посте предполагалось, что это может быть связано с OpenGL:

System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");
config.title = "Mygame";
config.width = 1920;
config.height = 1080;

Но, к сожалению, ничего не изменилось.Я хотел бы отладить игру с помощью модуля рабочего стола, так как отладка в эмуляторе Android является проблемой.любая помощь приветствуется.опять же, вышеприведенные 4 строки - единственные изменения, которые я внес в шаблонный код.

Ответы [ 2 ]

0 голосов
/ 07 декабря 2018

Я получал эту ошибку при использовании gradle 4.5.1 и плагина google для Android 3.1.0.

Обновление до gradle 4.6 и gradle android 3.2.0 избежать проблемы (как предложено в https://issuetracker.google.com/issues/77605097).

0 голосов
/ 21 мая 2018

Я создал новый новый проект и все еще получаю ту же ошибку.

Оказывается, как упомянуто в этой теме , отключение

настройка вкл.Спросите

, добавив:

org.gradle.configureondemand = false

к файлу «gradle.properties» и снимите флажок «Настроить по требованию» в свойствах проекта, что, как я проверял, решает проблему.

...