Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android build java.lang.NullPointerException (no error message) org.gradle.api.ProjectConfigurationException BUILD FAILED

This android project created on windows machine, setup a MacOS build machine and fetching the folders from Git and building it in Mac.

Here is the problem when I execute the gradle on mac. org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app' is the error occurring.

/gradlew tasks --stacktrace
Observed package id 'build-tools;25.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/build-tools/25.0.2' (Expected '/usr/local/Caskroom/android-sdk/build-tools/25.0.2')
Observed package id 'build-tools;26.0.1' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/build-tools/26.0.1' (Expected '/usr/local/Caskroom/android-sdk/build-tools/26.0.1')
Observed package id 'emulator' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/emulator' (Expected '/usr/local/Caskroom/android-sdk/emulator')
Observed package id 'extras;android;m2repository' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/android/m2repository' (Expected '/usr/local/Caskroom/android-sdk/extras/android/m2repository')
Observed package id 'extras;google;m2repository' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/google/m2repository' (Expected '/usr/local/Caskroom/android-sdk/extras/google/m2repository')
Observed package id 'extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2' (Expected '/usr/local/Caskroom/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2')
Observed package id 'extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2' (Expected '/usr/local/Caskroom/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2')
Observed package id 'patcher;v4' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/patcher/v4' (Expected '/usr/local/Caskroom/android-sdk/patcher/v4')
Observed package id 'platform-tools' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platform-tools' (Expected '/usr/local/Caskroom/android-sdk/platform-tools')
Observed package id 'platforms;android-25' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platforms/android-25' (Expected '/usr/local/Caskroom/android-sdk/platforms/android-25')
Observed package id 'platforms;android-26' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platforms/android-26' (Expected '/usr/local/Caskroom/android-sdk/platforms/android-26')
Observed package id 'tools' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools' (Expected '/usr/local/Caskroom/android-sdk/tools')

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:76)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:628)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:129)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
        at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:161)
        at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:158)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NullPointerException
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
        at com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.add(ImmutableCollection.java:339)
        at com.google.common.collect.ImmutableList$Builder.add(ImmutableList.java:652)
        at com.android.builder.sdk.DefaultSdkLoader.updateRepositories(DefaultSdkLoader.java:470)
        at com.android.build.gradle.internal.DependencyManager.collectArtifacts(DependencyManager.java:501)
        at com.android.build.gradle.internal.DependencyManager.resolveConfiguration(DependencyManager.java:354)
        at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:263)
        at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:166)
        at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:375)
        at com.android.build.gradle.internal.VariantManager.lambda$createVariantData$3(VariantManager.java:607)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
        at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:603)
        at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:793)
        at com.android.build.gradle.internal.VariantManager.populateVariantDataList(VariantManager.java:487)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
        at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:263)
        at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$6(BasePlugin.java:601)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
        at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:596)
        at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:526)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
        at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:522)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
        ... 56 more


BUILD FAILED

Total time: 9.926 secs
like image 821
bkm Avatar asked Oct 30 '22 01:10

bkm


1 Answers

I encountered this using JDK9 (9.0.4 specifically). When I switched back to JDK8, the gradle command succeeded. This was a project built with Gradle 4.4, target SDK 27 and using source and target compatibility of JavaVersion.VERSION_1_8. When I switched those back to 1.7 compatibility, the issue went away.

like image 58
amram99 Avatar answered Nov 11 '22 10:11

amram99