问:
Host name must not be empty with error : Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'
I have updated the Android Studio to 4.0, then while generating signed apk I received an error showing Host name must not be empty. But I was successfully able to debug the app in my device and is working fine. I did run a stack trace, it shows exception Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.

Exception is:

```org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:74)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:178)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:154)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:41)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:24)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:46)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:33)
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:383)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:247)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
    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:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    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:104)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalArgumentException: Host name may not be empty
    at org.apache.http.util.Args.containsNoBlanks(Args.java:84)
    at org.apache.http.HttpHost.<init>(HttpHost.java:80)
    at org.apache.http.HttpHost.<init>(HttpHost.java:99)
    at com.google.firebase.crashlytics.buildtools.api.net.proxy.ProxySettings.getConfig(ProxySettings.java:39)
    at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.sendFile(RestfulWebApi.java:154)
    at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.uploadFile(RestfulWebApi.java:180)
    at com.google.firebase.crashlytics.buildtools.api.FirebaseCodeMappingService.uploadObfuscatorMappingFile(FirebaseCodeMappingService.java:52)
    at com.google.firebase.crashlytics.buildtools.Buildtools.uploadMappingFile(Buildtools.java:168)
    at com.google.firebase.crashlytics.buildtools.Buildtools$uploadMappingFile$5.call(Unknown Source)
    at com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask.uploadMappingFile(UploadMappingFileTask.groovy:65)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:702)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:669)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
    at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
    ... 127 more
```

Do any one have an idea.??

答: Comment or disable your firebase crashlytics dependencies from both gradle app and project build till a new version is released compatible for gradle supported at Android studio 4.0</p>

Body:
I have updated the Android Studio to 4.0, then while generating signed apk I received an error showing Host name must not be empty. But I was successfully able to debug the app in my device and is working fine. I did run a stack trace, it shows exception Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.

Exception is:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:74)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:178)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:154)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:41)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:24)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:46)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:33)
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:383)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:247)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
    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:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    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:104)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalArgumentException: Host name may not be empty
    at org.apache.http.util.Args.containsNoBlanks(Args.java:84)
    at org.apache.http.HttpHost.<init>(HttpHost.java:80)
    at org.apache.http.HttpHost.<init>(HttpHost.java:99)
    at com.google.firebase.crashlytics.buildtools.api.net.proxy.ProxySettings.getConfig(ProxySettings.java:39)
    at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.sendFile(RestfulWebApi.java:154)
    at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.uploadFile(RestfulWebApi.java:180)
    at com.google.firebase.crashlytics.buildtools.api.FirebaseCodeMappingService.uploadObfuscatorMappingFile(FirebaseCodeMappingService.java:52)
    at com.google.firebase.crashlytics.buildtools.Buildtools.uploadMappingFile(Buildtools.java:168)
    at com.google.firebase.crashlytics.buildtools.Buildtools$uploadMappingFile$5.call(Unknown Source)
    at com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask.uploadMappingFile(UploadMappingFileTask.groovy:65)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:702)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:669)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
    at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
    ... 127 more

Do any one have an idea.??


来源: stackexchange

问:
Why is Functor in scala cats required
I have just started to learn Scala cats framework. I am reading Functor. I understood its features but I don't understand it's usage. Why should I use it if there is a map method already available in Functors like List, Option etc.

As an example,

```<code>val list = List(1, 2, 3)
Functor[List].map(list)(x => x * 2)
</code>```

But the same can be achieved with

```<code>list.map(x => x * 2)
</code>```

What do we get when we abstract the method map inside Functor trait.
Can someone please throw some light on it so that I understand its usage.

答:
You can call .map on object, when you know that this object has this method, and that this method is called this way. If you know exact type of the object, then compiler can check that, indeed, this is the case. But what if you don't know the type of the object? And what if you don't want to use runtime reflection?

Imagine situation like this:

```<code>def doubleIntInF[F[_]: Functor](fInt: F[Int]): F[Int] =
  fInt.map(_ * 2)
</code>```

Here, we don't know the type of F - it might be List, Option, Future, IO, Either[String, *]. And yet we are able to .map over it without using reflection - we use Functor[F] to power extension methods. We could do it also without extension method like this:

```<code>def doubleIntInF[F[_]: Functor](fInt: F[Int]): F[Int] =
  Functor[F].map(fInt)(_ * 2)
</code>```

and it would work (as long as we have the right implicits in scope):

```<code>doubleIntInF(List(1,2,3,4,5,6)) //  List(2, 4, 6, 8, 10, 12
doubleIntInF(Option(4)) // Some(2)
</code>```

In cases, where we know, that F=List, Option, etc - we have no reason to use it. But we have all the reasons to use if this F is dynamic.

And why would we like to make this F dynamic? To use it in libraries which e.g. could combine several functionalities provided through type classes together.

E.g. if you have F[_] and G[_] and you have Traverse[F] and Applicative[G] (more powerful Functor) you are able to turn F[G[A]] into G[F[A]]:

```<code>val listOption: List[Option] = List(Some(1), Some(2))
listOption.sequence // Some(List(1, 2))

val listFuture: List[Option] = List(Future(1), Future(2))
listFuture.sequence // Future(List(1, 2))
</code>```

Virtually all libraries in Cats ecosystem use this concept (called typeclasses) to implement functionality without assuming that you pick the same data structures and IO components as they would. As long as you can provide typeclass instances that proves that they can safely use some methods on your type, they can implement the functionality (e.g. Cats Effect are extending Cats with some typeclasses and Doobie, FS2, Http4s, and so on build on top of these without making assumption about what you use to run your computations).

So long story short - in cases like your it doesn't make sense to use Functor, but in general they enable you to still use .map in situations which are NOT as simple and you don't have a hardcoded type.

ContentLicense: CC BY-SA 4.0

Title: Why is Functor in scala cats required

Body:
I have just started to learn Scala cats framework. I am reading Functor. I understood its features but I don't understand it's usage. Why should I use it if there is a map method already available in Functors like List, Option etc.

As an example,

val list = List(1, 2, 3)
Functor[List].map(list)(x => x * 2)

But the same can be achieved with

list.map(x => x * 2)

What do we get when we abstract the method map inside Functor trait.
Can someone please throw some light on it so that I understand its usage.

Body:
You can call .map on object, when you know that this object has this method, and that this method is called this way. If you know exact type of the object, then compiler can check that, indeed, this is the case. But what if you don't know the type of the object? And what if you don't want to use runtime reflection?

Imagine situation like this:

def doubleIntInF[F[_]: Functor](fInt: F[Int]): F[Int] =
  fInt.map(_ * 2)

Here, we don't know the type of F - it might be List, Option, Future, IO, Either[String, *]. And yet we are able to .map over it without using reflection - we use Functor[F] to power extension methods. We could do it also without extension method like this:

def doubleIntInF[F[_]: Functor](fInt: F[Int]): F[Int] =
  Functor[F].map(fInt)(_ * 2)

and it would work (as long as we have the right implicits in scope):

doubleIntInF(List(1,2,3,4,5,6)) //  List(2, 4, 6, 8, 10, 12
doubleIntInF(Option(4)) // Some(2)

In cases, where we know, that F=List, Option, etc - we have no reason to use it. But we have all the reasons to use if this F is dynamic.

And why would we like to make this F dynamic? To use it in libraries which e.g. could combine several functionalities provided through type classes together.

E.g. if you have F[_] and G[_] and you have Traverse[F] and Applicative[G] (more powerful Functor) you are able to turn F[G[A]] into G[F[A]]:

val listOption: List[Option] = List(Some(1), Some(2))
listOption.sequence // Some(List(1, 2))

val listFuture: List[Option] = List(Future(1), Future(2))
listFuture.sequence // Future(List(1, 2))

Virtually all libraries in Cats ecosystem use this concept (called typeclasses) to implement functionality without assuming that you pick the same data structures and IO components as they would. As long as you can provide typeclass instances that proves that they can safely use some methods on your type, they can implement the functionality (e.g. Cats Effect are extending Cats with some typeclasses and Doobie, FS2, Http4s, and so on build on top of these without making assumption about what you use to run your computations).

So long story short - in cases like your it doesn't make sense to use Functor, but in general they enable you to still use .map in situations which are NOT as simple and you don't have a hardcoded type.


问:
How to add or save from web form (Javascript) entry as GeoPoint type in Firebase Firestore
Hi i have a web form which collect the following:

-cafe name
-latitude
-longitude of its location.

Currently, the lat and long is saved as map format instead of GeoPoint in Firestore.  Hence i would like to seek your advice on how it could be saved as GeoPoint format/data type.

```<code>form.addEventListener('submit',(e)=>{
  e.preventDefault();
  db.collection('sgcafe').add ({
    name: form.name.value,
    category: form.category.value,
    coordinates: {Latitude:form.lat.value,Longtitude:form.long.value} //save as map not Geopoint
</code>```

I tried all the following but it does not works.

```<code>   coordinates: new firebase.firestore.GeoPoint(form.lat.value, form.long.value)
   coordinates: firebase.firestore.GeoPoint(form.lat.value, form.long.value)
   coordinates: GeoPoint(form.lat.value, form.long.value)
</code>```

答:
If I'm right you need to send an array of coordinates to your firestore database so before the addition try this and then pass the array av value to your object's coordinates key.</p>

```<code>let coords = []
coords.push(new firebase.firestore.GeoPoint(form.lat.value, form.long.value))
</code>```

Body:
Hi i have a web form which collect the following:

-cafe name
-latitude
-longitude of its location.

Currently, the lat and long is saved as map format instead of GeoPoint in Firestore.  Hence i would like to seek your advice on how it could be saved as GeoPoint format/data type.

form.addEventListener('submit',(e)=>{
  e.preventDefault();
  db.collection('sgcafe').add ({
    name: form.name.value,
    category: form.category.value,
    coordinates: {Latitude:form.lat.value,Longtitude:form.long.value} //save as map not Geopoint

I tried all the following but it does not works.

   coordinates: new firebase.firestore.GeoPoint(form.lat.value, form.long.value)
   coordinates: firebase.firestore.GeoPoint(form.lat.value, form.long.value)
   coordinates: GeoPoint(form.lat.value, form.long.value)

Body:
If I'm right you need to send an array of coordinates to your firestore database so before the addition try this and then pass the array av value to your object's coordinates key.

let coords = []
coords.push(new firebase.firestore.GeoPoint(form.lat.value, form.long.value))


问:
Post comments on Facebook page via console
Like in the image, the Facebook comment box has no submit button, when you write something and press Enter button, the comment posted.

I want to submit the comment via JavaScript that running in console, but I tried to trigger Enter event, submit event of the DOM. Could not make it work.

答:
as I wasn't able to post comments through the "normal" facebook page, I remembered that they also have the mobile version, which is on m.facebook. com, there, they still have the submit Button, so depending on your needs, this may be a good option

so, you could go to the mobile facebook post (eg https://m.facebook.com/${author}/posts/${postId}) and do

```<code>// Find the input element that saves the message to be posted
document.querySelector("input[name='comment_text']").value='MESSAGE TO POST';
// find the submit button, enable it and click it
const submitButton = document.querySelector("button[name='submit']");
submitButton.disabled = false;
submitButton.click();
</code>```

Body:
as I wasn't able to post comments through the "normal" facebook page, I remembered that they also have the mobile version, which is on m.facebook. com, there, they still have the submit Button, so depending on your needs, this may be a good option

so, you could go to the mobile facebook post (eg https://m.facebook.com/${author}/posts/${postId}) and do

// Find the input element that saves the message to be posted
document.querySelector("input[name='comment_text']").value='MESSAGE TO POST';
// find the submit button, enable it and click it
const submitButton = document.querySelector("button[name='submit']");
submitButton.disabled = false;
submitButton.click();


问:
problem with declaring variable in php?
i have a variables like $srange0 , $srange1, $srange2 $srange3.

i am using to declare some value to each value using for loop.

```<code>for($i=0;$i<=3;$i++){
  $srange.$i = $i;
}
</code>```

but its not working ?

is there any alternative solution for this

答:
```<code>for($i=0;$i<=3;$i++){
  $var = 'srange'.$i;
  $$var = $i;
}
</code>```

But, whenever I see variables like that, I'd use an array instead.

ContentLicense: CC BY-SA 3.0

Title: problem with declaring variable in php?

Body:
i have a variables like $srange0 , $srange1, $srange2 $srange3.

i am using to declare some value to each value using for loop.

for($i=0;$i<=3;$i++){
  $srange.$i = $i;
}

but its not working ?

is there any alternative solution for this

Body:
for($i=0;$i<=3;$i++){
  $var = 'srange'.$i;
  $$var = $i;
}

But, whenever I see variables like that, I'd use an array instead.


问:
Drag Custom Annotation View
I have my CoreData custom Annotation class:

```<code>extension Annotation: MKAnnotation {

    public var coordinate: CLLocationCoordinate2D {
        let cllCoordinate = CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude)
        return cllCoordinate
    }

    public var title: String? {
        return self.objectId
    }

    class func keyPathsForValuesAffectingCoordinate() -> Set<String> {
        return Set<String>([ #keyPath(latitude), #keyPath(longitude) ])
    }

    @nonobjc public class func fetchRequest() -> NSFetchRequest<Annotation> {
        return NSFetchRequest<Annotation>(entityName: "Annotation")
    }

    @NSManaged public var latitude: Double
    @NSManaged public var longitude: Double
    @NSManaged public var dateTime: Date
    @NSManaged public var type: String
    @NSManaged public var objectId: String?

}
</code>```

combined with a fetchedResultsController adding and deleting annotations works fine. But now a want to drag an annotation to another position. But only with setting isDraggable to true is not all. I can’t find newer descriptions how this could be integrated.

Here my viewFor method:

```<code>func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {

    guard annotation is Annotation else { return nil }

    let identifier = "Annotation"
    var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)

    if annotationView == nil {
        annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: identifier)
        annotationView?.isDraggable = true
        annotationView?.canShowCallout = true
    } else {
        annotationView!.annotation = annotation
    }

    let customAnno = annotation as! Annotation
    let image = UIImage(named: customAnno.type)
    annotationView!.image = image

    return annotationView
}
</code>```

What else do i need? I want to press on the annotation, stay pressed and go to another position, then release the finger and the annotation stays there.

答:
When it drags, it needs to change the coordinate of the underlying annotation. It can’t do that if it’s read-only. So, if you want to make it draggable, you must give the coordinate property a setter:

```<code>public var coordinate: CLLocationCoordinate2D {
    get {
        CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }
    set {
        latitude = newValue.latitude
        longitude = newValue.longitude
    }
}
</code>```

Title: Drag Custom Annotation View

Body:
I have my CoreData custom Annotation class:

extension Annotation: MKAnnotation {

    public var coordinate: CLLocationCoordinate2D {
        let cllCoordinate = CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude)
        return cllCoordinate
    }

    public var title: String? {
        return self.objectId
    }

    class func keyPathsForValuesAffectingCoordinate() -> Set<String> {
        return Set<String>([ #keyPath(latitude), #keyPath(longitude) ])
    }

    @nonobjc public class func fetchRequest() -> NSFetchRequest<Annotation> {
        return NSFetchRequest<Annotation>(entityName: "Annotation")
    }

    @NSManaged public var latitude: Double
    @NSManaged public var longitude: Double
    @NSManaged public var dateTime: Date
    @NSManaged public var type: String
    @NSManaged public var objectId: String?

}

combined with a fetchedResultsController adding and deleting annotations works fine. But now a want to drag an annotation to another position. But only with setting isDraggable to true is not all. I can’t find newer descriptions how this could be integrated.

Here my viewFor method:

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {

    guard annotation is Annotation else { return nil }

    let identifier = "Annotation"
    var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)

    if annotationView == nil {
        annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: identifier)
        annotationView?.isDraggable = true
        annotationView?.canShowCallout = true
    } else {
        annotationView!.annotation = annotation
    }

    let customAnno = annotation as! Annotation
    let image = UIImage(named: customAnno.type)
    annotationView!.image = image

    return annotationView
}

What else do i need? I want to press on the annotation, stay pressed and go to another position, then release the finger and the annotation stays there.

Body:
When it drags, it needs to change the coordinate of the underlying annotation. It can’t do that if it’s read-only. So, if you want to make it draggable, you must give the coordinate property a setter:

public var coordinate: CLLocationCoordinate2D {
    get {
        CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }
    set {
        latitude = newValue.latitude
        longitude = newValue.longitude
    }
}


问:
Angular Project Structure with separate package.json files
I saw this Project Structure in Angular with Node.js as backend, where the Angular node modules and package.json were in the "app" folder, while the node.js' node modules and package.json were in the root of the project. (watch picture)

How do i get the requested outcome?

答:
I recommand that you use NX https://nx.dev/, it will give you a perfect structure and many benefits of monorepos, you can have multiple angular apps and a node backend taht you can it as an app like this

```<code>ng g node-app backend-api
</code>```

You will have a structure like this:

```<code>apps/
  angularApp-1/
  angularApp-1-e2e/
  angularApp-2/
  angularApp-2-e2e/
  api/ //your node app
   src/
     app/
     assets/
     environemnts/
     main.ts
   jest.config.js
   tsconfig.app.json
   tsconfig.spec.json
  tslint.json
libs/

tools/
angular.json
nx.json
package.json
tsconfig.json
tslint.json
</code>```

Body:
I recommand that you use NX https://nx.dev/, it will give you a perfect structure and many benefits of monorepos, you can have multiple angular apps and a node backend taht you can it as an app like this

ng g node-app backend-api

You will have a structure like this:

apps/
  angularApp-1/
  angularApp-1-e2e/
  angularApp-2/
  angularApp-2-e2e/
  api/ //your node app
   src/
     app/
     assets/
     environemnts/
     main.ts
   jest.config.js
   tsconfig.app.json
   tsconfig.spec.json
  tslint.json
libs/

tools/
angular.json
nx.json
package.json
tsconfig.json
tslint.json


问:
How to minimize the RAM requirements for copying data from (large) partitioned table to another partitioned table?
For two big tables, table1 and table2 with thousands of partitions and 150 million rows in table1, mysql/mariadb performs this query inefficiently.

```<code>insert into table2 select * from table1
</code>```

In fact, using 8192 partitions on both tables, RAM was exhausted before the query ended. I had to terminate it when it had allocated 6.1 GB of RAM, since this particular box had only 8 GB of RAM. How can this task be performed with a lower RAM footprint?

答:
By forcing mysql/mariadb to deal with data from one partition at a time, the task could be completed, using less than 500 MB RAM at any point.

The structure of the solution is like this:

```<code>insert into table2 select * from table1 partition (p<X>)
</code>```

where X should be the full set of integers that correspond to the partitions, in my case from 0 to 8191. This can be implemented esing a stored procedure as this one:

```<code>drop procedure if exists my_partitioning_data_copy_procedure;

delimiter #
create procedure my_partitioning_data_copy_procedure()
begin

declare v_max int unsigned default 8191;
declare v_counter int unsigned default 0;

  start transaction;
  while v_counter < v_max do
    SET @expression = concat("insert into table2 select * from table1 partition (p", v_counter, ");");
    prepare myquery from @expression;
    execute myquery;
    set v_counter=v_counter+1;
  end while;
  commit;
end #

delimiter ;

call my_partitioning_data_copy_procedure();
</code>```

Body:
For two big tables, table1 and table2 with thousands of partitions and 150 million rows in table1, mysql/mariadb performs this query inefficiently.

insert into table2 select * from table1

In fact, using 8192 partitions on both tables, RAM was exhausted before the query ended. I had to terminate it when it had allocated 6.1 GB of RAM, since this particular box had only 8 GB of RAM. How can this task be performed with a lower RAM footprint?

Body:
By forcing mysql/mariadb to deal with data from one partition at a time, the task could be completed, using less than 500 MB RAM at any point.

The structure of the solution is like this:

insert into table2 select * from table1 partition (p<X>)

where X should be the full set of integers that correspond to the partitions, in my case from 0 to 8191. This can be implemented esing a stored procedure as this one:

drop procedure if exists my_partitioning_data_copy_procedure;

delimiter #
create procedure my_partitioning_data_copy_procedure()
begin

declare v_max int unsigned default 8191;
declare v_counter int unsigned default 0;

  start transaction;
  while v_counter < v_max do
    SET @expression = concat("insert into table2 select * from table1 partition (p", v_counter, ");");
    prepare myquery from @expression;
    execute myquery;
    set v_counter=v_counter+1;
  end while;
  commit;
end #

delimiter ;

call my_partitioning_data_copy_procedure();


问:
What is the difference between workerNum and localExcutors in the dolphindb configuration file?
What is the difference between workerNum and localExcutors in the dolphindb configuration file? In tutorial, we often see that workerNum is 1 larger than localExcutors,that is why?</p>

答:
A worker is designed to receive and coordinate users' request. The workerNum limits the number of jobs a DolphinDB instance can process simultaneously. If the requested job is simple, the worker just does it by itself. Otherwise, the coordinating worker breaks the job down into sub tasks, and then assigns those sub-tasks to itself and the local executors in a pool. Upon completion of all sub-tasks, the coordinating worker merges the individual results from sub-tasks and then returns it to the client.

In summary, a worker can serve as both coordinator and executor while a local executor can only be used as a job executor.


问:
How to use Android documentation while developing in Eclipse with ADT?
I have installed Documentation for Android package using AVD manager.

On hovering over any element it pops up "Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc"

I can't figure exactly what needs to be set in javadoc location in project properties or something else needs to be done :-/

答: Can you provide any example on where the javadoc isn't available? I had the same doubts, but as soon as I opened the Eclipse view "Javadoc" and selected the class/method I wanted to know more about, there the doc appeared.</p>


问:
How to group by using bit column?
my table data

```<code>id  quota
1  0
1  NULL
1  1
2  0
2  NULL
3  NULL
</code>```

Result I Except

```<code>id  quota
1  1
2  0
3  NULL
</code>```

Result I am getting:

```<code>id  quota
1  1
2  0
3  0
</code>```

Query I am using:

```<code> select id,count(id) count_id,
 case when max(coalesce(quota,0)) = 1 then 1
 when max(coalesce(quota,0)) = 0 then 0
 else null
 end as quota from forbit group by i
</code>```

My data type for column quota is bit.

I want whenever the max in group is 1 give quota as 1, whenever the max in group is 0 give quota as 0 and whenever the max in group is null give quota as null.
I basically want to achieve NULL for id 3.

Similar post I saw:
Use column of type bit to differentiate group by?

答:
It seems you are over thinking tings, you can do it with simple query as below:</p>

```<code>select max(cast(quota) as int) as max_val, id
from test
group by id
</code>```

Title: How to group by using bit column?

Body:
my table data

id  quota
1  0
1  NULL
1  1
2  0
2  NULL
3  NULL

Result I Except

id  quota
1  1
2  0
3  NULL

Result I am getting:

id  quota
1  1
2  0
3  0

Query I am using:

 select id,count(id) count_id,
 case when max(coalesce(quota,0)) = 1 then 1
 when max(coalesce(quota,0)) = 0 then 0
 else null
 end as quota from forbit group by i

My data type for column quota is bit.

I want whenever the max in group is 1 give quota as 1, whenever the max in group is 0 give quota as 0 and whenever the max in group is null give quota as null.
I basically want to achieve NULL for id 3.

Similar post I saw:
Use column of type bit to differentiate group by?

Body:
It seems you are over thinking tings, you can do it with simple query as below:

select max(cast(quota) as int) as max_val, id
from test
group by id


问:
How can I modify the input of multiple EditTexts at the same time, as I only modify one?
I have multiple EditTexts and I want to change the input of all of them at the same time, as I modify only one.(all of them take decimal numbers as input)

I stored the EditTexts in an array named 'editTexts'.

Here's what I tried

```<code>//Set the listener for each element
for (int i=0; i<editTexts.length; i++) {
        final int finalI = i;
        editTexts[i].addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
//if the editText which is currently edited is empty, set the input for all the rest to be '0.0'
                if (editTexts[finalI].getText().toString().trim().length() == 0) {
                    for(EditText e : editTexts) {
                        if (e == editTexts[finalI])
                            continue;
                        e.setText("0.0");
                    }
                } else {
                    float no = Float.parseFloat(s.toString() + "");
//Set the input of all the other editTexts to be the decimal number entered, multiplied by 2
                    for(EditText e : editTexts){
                        if(e == editTexts[finalI])
                            continue;
                        e.setText(no*2+"");
                    }
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        })
    }
</code>```

In this case the multiplication coefficient is just an example, it's not always gonna be 2. I used it just to test it out.

For some reason, when I change the input value, the app freezes.

Any help? Thanks!

答:
Use LiveData to store your user input values.
Once it's value changes you can set value to each EditText. I think it is an easy way to implement.

Body:
I have multiple EditTexts and I want to change the input of all of them at the same time, as I modify only one.(all of them take decimal numbers as input)

I stored the EditTexts in an array named 'editTexts'.

Here's what I tried

//Set the listener for each element
for (int i=0; i<editTexts.length; i++) {
        final int finalI = i;
        editTexts[i].addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
//if the editText which is currently edited is empty, set the input for all the rest to be '0.0'
                if (editTexts[finalI].getText().toString().trim().length() == 0) {
                    for(EditText e : editTexts) {
                        if (e == editTexts[finalI])
                            continue;
                        e.setText("0.0");
                    }
                } else {
                    float no = Float.parseFloat(s.toString() + "");
//Set the input of all the other editTexts to be the decimal number entered, multiplied by 2
                    for(EditText e : editTexts){
                        if(e == editTexts[finalI])
                            continue;
                        e.setText(no*2+"");
                    }
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        })
    }

In this case the multiplication coefficient is just an example, it's not always gonna be 2. I used it just to test it out.

For some reason, when I change the input value, the app freezes.

Any help? Thanks!


问:
pausing for loop of a data stream for further manipulation
have the following code resulting in a streaming data frame with over 5000 rows every minute. As this data frame is within a for loop am unable to manipulate the data within the data frame. So I need to know how to segregate the data frame to come be out of the for loop, say every 5 minute and then restart again to collect the information in the data frame.
'''

```<code> df=pd.DataFrame(data=None)

def on_ticks(ws, ticks):
global df
for sc in ticks:
    token=sc['instrument_token']
    name=trd_portfolio[token]['name']
    ltp=sc['last_price']
    df1=pd.DataFrame([name,ltp]).T
    df1.columns=['name','ltp']
    df=df.append(df1,ignore_index=True)

    print(df)
</code>```

'''
Resultant output is

```<code>           name     ltp
0          GLAXO  1352.2
1           GSPL  195.75
2           ABAN      18
3     ADANIPOWER    36.2
4        CGPOWER       6
...          ...     ...
1470      COLPAL    1317
1471         ITC   196.2
1472    JUBLFOOD  1698.5
1473     HCLTECH   550.6
1474      INDIGO   964.8

[1475 rows x 2 columns]
</code>```

further manipulation required on the data frame are like:
'''

```<code>df['change']=df.groupby('name')['ltp'].pct_change()*100
g = df.groupby('name')['change']
counts = g.agg(
pos_count=lambda s: s.gt(0).sum(),
neg_count=lambda s: s.lt(0).sum(),
net_count=lambda s: s.gt(0).sum()- s.lt(0).sum()).astype(int)
print(counts)
</code>```

'''

However, am unable to freeze the for loop for a certain time for other processes to happen.  I did try the sleep method, but it sleeps for given time and then goes back to the for loop.

Need guidance on how we can freeze the for loop for certain time so that the other codes can be executed and gain going back to the for loop to continue collecting the data.

答:
There is no pausing of the loop but you can just pass the arguments to some other function that performs the other operations after every n iterations.The sudo code would be something like.

```<code>for loop in range(10000):
    data        #collecting data
    if loop==100:
        other_operation(data):

def other_operation(data):
    #perform other operations here
</code>```

This willperform the other manipulations after every 100 loop iterations.

Body:
have the following code resulting in a streaming data frame with over 5000 rows every minute. As this data frame is within a for loop am unable to manipulate the data within the data frame. So I need to know how to segregate the data frame to come be out of the for loop, say every 5 minute and then restart again to collect the information in the data frame.
'''

 df=pd.DataFrame(data=None)

def on_ticks(ws, ticks):
global df
for sc in ticks:
    token=sc['instrument_token']
    name=trd_portfolio[token]['name']
    ltp=sc['last_price']
    df1=pd.DataFrame([name,ltp]).T
    df1.columns=['name','ltp']
    df=df.append(df1,ignore_index=True)

    print(df)

'''
Resultant output is

           name     ltp
0          GLAXO  1352.2
1           GSPL  195.75
2           ABAN      18
3     ADANIPOWER    36.2
4        CGPOWER       6
...          ...     ...
1470      COLPAL    1317
1471         ITC   196.2
1472    JUBLFOOD  1698.5
1473     HCLTECH   550.6
1474      INDIGO   964.8

[1475 rows x 2 columns]

further manipulation required on the data frame are like:
'''

df['change']=df.groupby('name')['ltp'].pct_change()*100
g = df.groupby('name')['change']
counts = g.agg(
pos_count=lambda s: s.gt(0).sum(),
neg_count=lambda s: s.lt(0).sum(),
net_count=lambda s: s.gt(0).sum()- s.lt(0).sum()).astype(int)
print(counts)

'''

However, am unable to freeze the for loop for a certain time for other processes to happen.  I did try the sleep method, but it sleeps for given time and then goes back to the for loop.

Need guidance on how we can freeze the for loop for certain time so that the other codes can be executed and gain going back to the for loop to continue collecting the data.

Body:
There is no pausing of the loop but you can just pass the arguments to some other function that performs the other operations after every n iterations.The sudo code would be something like.

for loop in range(10000):
    data        #collecting data
    if loop==100:
        other_operation(data):

def other_operation(data):
    #perform other operations here

This willperform the other manipulations after every 100 loop iterations.


问:
Counting vowels using switch
I tried to design a program which counts the vowels in a sentence.

In my code, I used a foreach statement with the if/else if statement. I would like to convert these line of code using the switch statement
but I'm not really sure where to go. Do I need to add a new method? I would appreciate your help.

This is what I tried so far: I checked this one is very wrong. The case 1 for example needs to have a constant. I'm not sure what constant shall I use here.

```<code>foreach (char v in yourSentence)
{
    switch (v)
    {
    case 1:
        (v==ch1);
        counta++;
        j++;
        break;

    case 2:
        (v==ch2);
        counte++;
        j++;
        break;
    case 3:
        (v==ch3);
        counti++;
        j++;
        break;
    case 4:
        (v==ch4);
        counto++;
        j++;
        break;
    case 5:
        (v==ch3);
        counti++;
        j++;
        break;
    }
}
</code>```

Another question:  I tried to change the color of the display text in the listBox. Is that possible to have different colors? What I also tried here is the first 5 (listBox1.Items.Add) are violet. And the sum of the (listBox1.Items.Add) is blue. But it seems that it didn't change. Did I miss something here?

```<code>private void btnCount_Click(object sender, EventArgs e)
{
    string yourSentence;
    yourSentence = textBoxVowels.Text.ToLower().Trim();

    char ch1 = 'a';
    char ch2 = 'e';
    char ch3 = 'i';
    char ch4 = 'o';
    char ch5 = 'u';

    int counta = 0;
    int counte = 0;
    int counti = 0;
    int counto = 0;
    int countu = 0;

    int j = counta + counte + counti + counto + countu;

    foreach (char v in yourSentence)
    {
        if (v == ch1) { counta++; j++; }

        else if (v == ch2) { counte++; j++; }

        else if (v == ch3) { counti++; j++; }

        else if (v == ch4) { counto++; j++; }

        else if (v == ch5) { countu++; j++; }
    }

    listBox1.Items.Add("There are " + counta.ToString().Trim() + " a's in the sentence");
    listBox1.Items.Add("There are " + counte.ToString().Trim() + " e's in the sentence");
    listBox1.Items.Add("There are " + counti.ToString().Trim() + " i's in the sentence");
    listBox1.Items.Add("There are " + counto.ToString().Trim() + " o's in the sentence");
    listBox1.Items.Add("There are " + countu.ToString().Trim() + " u's in the sentence");
    listBox1.Font = new Font("Arial", 12, FontStyle.Bold);
    listBox1.ForeColor = Color.Violet;

    listBox1.Items.Add("There are " + j.ToString().Trim() + " vowels in the sentence");
    listBox1.ForeColor = Color.Blue;
}

private void btnClear_Click(object sender, EventArgs e)
{
    textBoxVowels.Text = null;
    listBox1.Items.Clear();
}
</code>```

答:
I faced a similar kind of problem in an interview. But I had to show my result in a level control instead of listbox control ... so i solved this problem like this:</p>

```<code>protected void Button1_Click(object sender, EventArgs e)
{
    string EnterString;
    EnterString = TextBox1.Text;
    char ch1 = 'a';
    char ch2 = 'e';
    char ch3 = 'i';
    char ch4 = 'o';
    char ch5 = 'u';

    int counta = 0;
    int counte = 0;
    int counti = 0;
    int counto = 0;
    int countu = 0;
    char ch6 = 'A';
    char ch7 = 'E';
    char ch8 = 'I';
    char ch9 = 'O';
    char ch10 = 'U';

    int countA = 0;
    int countE = 0;
    int countI = 0;
    int countO = 0;
    int countU = 0;

    int j = counta + counte + counti + counto + countu + countA + countE + countI + countO + countU;

    foreach (char v in EnterString)
    {
        if (v == ch1) { counta++; j++; }

        else if (v == ch2) { counte++; j++; }

        else if (v == ch3) { counti++; j++; }

        else if (v == ch4) { counto++; j++; }

        else if (v == ch5) { countu++; j++; }
    }
    foreach (char v in EnterString)
    {
        if (v == ch6) { countA++; j++; }

        else if (v == ch7) { countE++; j++; }

        else if (v == ch8) { countI++; j++; }

        else if (v == ch9) { countO++; j++; }

        else if (v == ch10) { countU++; j++; }
    }

    Label1.Text = j.ToString();
}
</code>```

Title: Counting vowels using switch

Body:
I tried to design a program which counts the vowels in a sentence.

In my code, I used a foreach statement with the if/else if statement. I would like to convert these line of code using the switch statement
but I'm not really sure where to go. Do I need to add a new method? I would appreciate your help.

This is what I tried so far: I checked this one is very wrong. The case 1 for example needs to have a constant. I'm not sure what constant shall I use here.

foreach (char v in yourSentence)
{
    switch (v)
    {
    case 1:
        (v==ch1);
        counta++;
        j++;
        break;

    case 2:
        (v==ch2);
        counte++;
        j++;
        break;
    case 3:
        (v==ch3);
        counti++;
        j++;
        break;
    case 4:
        (v==ch4);
        counto++;
        j++;
        break;
    case 5:
        (v==ch3);
        counti++;
        j++;
        break;
    }
}

Another question:  I tried to change the color of the display text in the listBox. Is that possible to have different colors? What I also tried here is the first 5 (listBox1.Items.Add) are violet. And the sum of the (listBox1.Items.Add) is blue. But it seems that it didn't change. Did I miss something here?

private void btnCount_Click(object sender, EventArgs e)
{
    string yourSentence;
    yourSentence = textBoxVowels.Text.ToLower().Trim();

    char ch1 = 'a';
    char ch2 = 'e';
    char ch3 = 'i';
    char ch4 = 'o';
    char ch5 = 'u';

    int counta = 0;
    int counte = 0;
    int counti = 0;
    int counto = 0;
    int countu = 0;

    int j = counta + counte + counti + counto + countu;

    foreach (char v in yourSentence)
    {
        if (v == ch1) { counta++; j++; }

        else if (v == ch2) { counte++; j++; }

        else if (v == ch3) { counti++; j++; }

        else if (v == ch4) { counto++; j++; }

        else if (v == ch5) { countu++; j++; }
    }

    listBox1.Items.Add("There are " + counta.ToString().Trim() + " a's in the sentence");
    listBox1.Items.Add("There are " + counte.ToString().Trim() + " e's in the sentence");
    listBox1.Items.Add("There are " + counti.ToString().Trim() + " i's in the sentence");
    listBox1.Items.Add("There are " + counto.ToString().Trim() + " o's in the sentence");
    listBox1.Items.Add("There are " + countu.ToString().Trim() + " u's in the sentence");
    listBox1.Font = new Font("Arial", 12, FontStyle.Bold);
    listBox1.ForeColor = Color.Violet;

    listBox1.Items.Add("There are " + j.ToString().Trim() + " vowels in the sentence");
    listBox1.ForeColor = Color.Blue;
}

private void btnClear_Click(object sender, EventArgs e)
{
    textBoxVowels.Text = null;
    listBox1.Items.Clear();
}

Body:
I faced a similar kind of problem in an interview. But I had to show my result in a level control instead of listbox control ... so i solved this problem like this:

protected void Button1_Click(object sender, EventArgs e)
{
    string EnterString;
    EnterString = TextBox1.Text;
    char ch1 = 'a';
    char ch2 = 'e';
    char ch3 = 'i';
    char ch4 = 'o';
    char ch5 = 'u';

    int counta = 0;
    int counte = 0;
    int counti = 0;
    int counto = 0;
    int countu = 0;
    char ch6 = 'A';
    char ch7 = 'E';
    char ch8 = 'I';
    char ch9 = 'O';
    char ch10 = 'U';

    int countA = 0;
    int countE = 0;
    int countI = 0;
    int countO = 0;
    int countU = 0;

    int j = counta + counte + counti + counto + countu + countA + countE + countI + countO + countU;

    foreach (char v in EnterString)
    {
        if (v == ch1) { counta++; j++; }

        else if (v == ch2) { counte++; j++; }

        else if (v == ch3) { counti++; j++; }

        else if (v == ch4) { counto++; j++; }

        else if (v == ch5) { countu++; j++; }
    }
    foreach (char v in EnterString)
    {
        if (v == ch6) { countA++; j++; }

        else if (v == ch7) { countE++; j++; }

        else if (v == ch8) { countI++; j++; }

        else if (v == ch9) { countO++; j++; }

        else if (v == ch10) { countU++; j++; }
    }

    Label1.Text = j.ToString();
}


问:
How do I parse url after searching?
I'm trying to parse a specifc part of url after search using
any language.(Ideally Javascript but open to Python)

How do I get a specific part of url and save/store?

For example,
In songking.com,
The way to get artist_id is checking a specific part of the url after searching artist name
in the search bar of the website.

in the case below,
the artist id is 301329.

https://www.songkick.com/artists/301329-rac

I strongly believe there is a way to parse this part using either python or js
given that I have a csv file that has artist name in its column. Instead of searching all the artists one by one. I wonder about the algorithm that literate my csv column and search it and parse the url and save/store.

It would be very grateful even if I could only get a hint that I could start with.

Thank you so much always.

答:
It can be done using regular expressions.

Here's an example of a JavaScript implementation

const url = "https://www.songkick.com/artists/301329-rac";

const regex = /https:\/\/www\.songkick\.com\/artists\/(\d+)-.+/;

const match = url.match(regex);

if (match) {
  console.log('Artist ID: ' + match[1]);
} else {
  console.log('No Artist ID found!');
}
```

This regular expression /https:\/\/www\.songkick\.com\/artists\/(\d+)-.+/ means that we're trying to match something that starts with https://www.songkick.com/artists/, preceded by a group of decimals a dash then a group of letters.

The match() method retrieves the result of matching a string against a
  regular expression.

Thus it will return the overall string in the first index, then the matched (\d+) group in the second index (match[1] in our case).

If you're not sure of the protocol (http vs https) you can add a ? in the regex right after https. That makes the s in https optional. So the regex would become /https?:\/\/www\.songkick\.com\/artists\/(\d+)-.+/.

Let me know if you need more explanation.

Title: How do I parse url after searching?

Body:
It can be done using regular expressions.

Here's an example of a JavaScript implementation

const url = "https://www.songkick.com/artists/301329-rac";

const regex = /https:\/\/www\.songkick\.com\/artists\/(\d+)-.+/;

const match = url.match(regex);

if (match) {
  console.log('Artist ID: ' + match[1]);
} else {
  console.log('No Artist ID found!');
}

This regular expression /https:\/\/www\.songkick\.com\/artists\/(\d+)-.+/ means that we're trying to match something that starts with https://www.songkick.com/artists/, preceded by a group of decimals a dash then a group of letters.

The match() method retrieves the result of matching a string against a
  regular expression.

Thus it will return the overall string in the first index, then the matched (\d+) group in the second index (match[1] in our case).

If you're not sure of the protocol (http vs https) you can add a ? in the regex right after https. That makes the s in https optional. So the regex would become /https?:\/\/www\.songkick\.com\/artists\/(\d+)-.+/.

Let me know if you need more explanation.


问:
Is there a C++ preprocessor directive or similar that I can use to convert units
I am doing a bit of motor control, and instead of saying 39553 encoder ticks, it would be easier for my human brain to say 6.5 inches.  I would like to save processor overhead by converting this at compile time.  Is there a way to do this with preprocessor directives or templates maybe?  Thanks.</p>

答:
I would use a constexpr for this. As @ChrisMM mentioned, it is not preprocessor, but it will be evaluated at compile time rather than run time. If the values you gave correspond to the actual relationship between ticks and inches, you can use:

```<code>constexpr int toTicks(double inches) {
    return int(6085 * inches);
}
</code>```

By doing the cast to an int, you can make sure you do not ever ask the motor to move some fraction of a tick. The only thing to be cautious of with an approach like this is that over time if you ask the motor to move to a bunch of different locations without returning to the origin between each move your origin can slowly shift with rounding errors from the conversion to an int.

Body:
I would use a constexpr for this. As @ChrisMM mentioned, it is not preprocessor, but it will be evaluated at compile time rather than run time. If the values you gave correspond to the actual relationship between ticks and inches, you can use:

constexpr int toTicks(double inches) {
    return int(6085 * inches);
}

By doing the cast to an int, you can make sure you do not ever ask the motor to move some fraction of a tick. The only thing to be cautious of with an approach like this is that over time if you ask the motor to move to a bunch of different locations without returning to the origin between each move your origin can slowly shift with rounding errors from the conversion to an int.


问:
What is the advantage of using scala pattern matching instead of java switch case?
Everybody says that pattern matching is a great feature in functional languages. Why?

Can't I simple use ifs and switch cases for everything?

I'd like to understand the advantages of using pattern matching instead of regular procedural programming ifs and switch cases

答:
JMPL is simple java library, which could emulate some of the features pattern matching, using Java 8 features.</p>

```<code>      matches(data).as(
          new Person("man"),    () ->  System.out.println("man");
          new Person("woman"),  () ->  System.out.println("woman");
          new Person("child"),  () ->  System.out.println("child");
          Null.class,           () ->  System.out.println("Null value "),
          Else.class,           () ->  System.out.println("Default value: " + data)
       );

       matches(data).as(
          Integer.class, i  -> { System.out.println(i * i); },
          Byte.class,    b  -> { System.out.println(b * b); },
          Long.class,    l  -> { System.out.println(l * l); },
          String.class,  s  -> { System.out.println(s * s); },
          Null.class,    () -> { System.out.println("Null value "); },
          Else.class,    () -> { System.out.println("Default value: " + data); }
       );

       matches(figure).as(
          Rectangle.class, (int w, int h) -> System.out.println("square: " + (w * h)),
          Circle.class,    (int r)        -> System.out.println("square: " + (2 * Math.PI * r)),
          Else.class,      ()             -> System.out.println("Default square: " + 0)
       );
</code>```

Body:
JMPL is simple java library, which could emulate some of the features pattern matching, using Java 8 features.

      matches(data).as(
          new Person("man"),    () ->  System.out.println("man");
          new Person("woman"),  () ->  System.out.println("woman");
          new Person("child"),  () ->  System.out.println("child");
          Null.class,           () ->  System.out.println("Null value "),
          Else.class,           () ->  System.out.println("Default value: " + data)
       );

       matches(data).as(
          Integer.class, i  -> { System.out.println(i * i); },
          Byte.class,    b  -> { System.out.println(b * b); },
          Long.class,    l  -> { System.out.println(l * l); },
          String.class,  s  -> { System.out.println(s * s); },
          Null.class,    () -> { System.out.println("Null value "); },
          Else.class,    () -> { System.out.println("Default value: " + data); }
       );

       matches(figure).as(
          Rectangle.class, (int w, int h) -> System.out.println("square: " + (w * h)),
          Circle.class,    (int r)        -> System.out.println("square: " + (2 * Math.PI * r)),
          Else.class,      ()             -> System.out.println("Default square: " + 0)
       );


问:
How can I make a bootstrap media list with a scroll bar?
Here is my code:

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

     <video id="selfView" class="h-100 w-100 position-absolute" controls muted>
      <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
     </video>

      TV:On
      <input type="checkbox" id="shareVideo" checked>

      Light:On
      <input type="checkbox" id="shareAudio" checked>

      Air Cond:Off
      <input type="checkbox" id="shareScreen">

      <button class="btn-sm btn btn-lg btn-success">Create a meeting</button>

        i

        f

        c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

        2

        3

```

How can I make the bootstrap media list(i.e line 81) with a scroll bar?

I have using a "position-relative" and "position-absolute" class to make the browser show a scroll bar.

Unfortunately, it does not work.

It is because when I browse the web page with a mobile phone the media list is too long.

答:
Use CSS, place this into the empty  tag, and remove the overflow-auto h-100 classes from the ul.

```<code>#pills-info {
  height: calc(100vh - 100px);
  overflow-y: scroll
}
</code>```

Body:
Here is my code:

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

     <video id="selfView" class="h-100 w-100 position-absolute" controls muted>
      <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
     </video>

      TV:On
      <input type="checkbox" id="shareVideo" checked>

      Light:On
      <input type="checkbox" id="shareAudio" checked>

      Air Cond:Off
      <input type="checkbox" id="shareScreen">

      <button class="btn-sm btn btn-lg btn-success">Create a meeting</button>

        i

        f

        c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

         a

         b

         c

        2

        3

How can I make the bootstrap media list(i.e line 81) with a scroll bar?

I have using a "position-relative" and "position-absolute" class to make the browser show a scroll bar.

Unfortunately, it does not work.

It is because when I browse the web page with a mobile phone the media list is too long.

Body:
Use CSS, place this into the empty <style></style> tag, and remove the overflow-auto h-100 classes from the ul.

#pills-info {
  height: calc(100vh - 100px);
  overflow-y: scroll
}


问:
How to get menu reference from an activity
I am writing JUnit test scripts for an Android project. What I intent to test is the options menu items (you know, the menu invoked by pressing menu key) from an activity.

However, in our project the menu is generated dynamically from some internet content.
Most importantly, the Menu object is a private variable in our activity object.

Now my question is, how can I verify the this menu (verify its number of menuitems, text on each items, etc).

答: To test the invocation of menu items you can use Instrumentation.invokeMenuActionSync().</p>


问:
Adding column conditioning on the other columns
I want to create a new column z based on the values of x and y.  If x>y, z=y otherwise z=x.

```<code>x  y
3  4
5  2
6  6
1  7
9  4
</code>```

Output required:

```<code>x  y  z
3  4  3
5  2  2
6  6  6
1  7  1
9  4  4
</code>```

答:
Similar to another answer but using data.table and pmin:

```<code>library(data.table)
dt <- data.table(x = c(3,5,6,1,9),
                 y = c(4,2,6,7,4))

dt[, z:= pmin(x,y)]
dt

# x y z
# 1: 3 4 3
# 2: 5 2 2
# 3: 6 6 6
# 4: 1 7 1
# 5: 9 4 4
</code>```

Function pmin returns the parallel minima (https://www.rdocumentation.org/packages/mc2d/versions/0.1-17/topics/pmin)

Body:
I want to create a new column z based on the values of x and y.  If x>y, z=y otherwise z=x.

x  y
3  4
5  2
6  6
1  7
9  4

Output required:

x  y  z
3  4  3
5  2  2
6  6  6
1  7  1
9  4  4

Body:
Similar to another answer but using data.table and pmin:

library(data.table)
dt <- data.table(x = c(3,5,6,1,9),
                 y = c(4,2,6,7,4))

dt[, z:= pmin(x,y)]
dt

# x y z
# 1: 3 4 3
# 2: 5 2 2
# 3: 6 6 6
# 4: 1 7 1
# 5: 9 4 4

Function pmin returns the parallel minima (https://www.rdocumentation.org/packages/mc2d/versions/0.1-17/topics/pmin)


问:
Sorting two lists that aren't related in Dart
Suppose that I have two lists in Dart

List a = [Instance of <Something>, Instance of <Something>, Instance of <Something> ....]
which contains the instances of a class and List b = [165, 75, 123 .... ]

I want to sort List b in ascending order but I want the same to be reflected on List a as well. How do I do it?

答:
I am not sure if this can be done in a more efficient way but you can do something like this. I assume the two list you want to sort has the same length.</p>

```<code>class Something {
  final String name;

  Something(this.name);

  @override
  String toString() => name;
}

class Pair<T1, T2> {
  final T1 a;
  final T2 b;

  Pair(this.a, this.b);
}

void main() {
  final a = [Something('A'), Something('E'), Something('B'), Something('C')];
  final b = [1, 5, 2, 3];

  final tempList =
      List.generate(a.length, (i) => Pair(a[i], b[i]), growable: false)
        ..sort((p1, p2) => p1.b.compareTo(p2.b));

  for (var i = 0; i < tempList.length; i++) {
    final pair = tempList[i];
    a[i] = pair.a;
    b[i] = pair.b;
  }

  print(a); // [A, B, C, E]
  print(b); // [1, 2, 3, 5]
}
</code>```

Body:
I am not sure if this can be done in a more efficient way but you can do something like this. I assume the two list you want to sort has the same length.

class Something {
  final String name;

  Something(this.name);

  @override
  String toString() => name;
}

class Pair<T1, T2> {
  final T1 a;
  final T2 b;

  Pair(this.a, this.b);
}

void main() {
  final a = [Something('A'), Something('E'), Something('B'), Something('C')];
  final b = [1, 5, 2, 3];

  final tempList =
      List.generate(a.length, (i) => Pair(a[i], b[i]), growable: false)
        ..sort((p1, p2) => p1.b.compareTo(p2.b));

  for (var i = 0; i < tempList.length; i++) {
    final pair = tempList[i];
    a[i] = pair.a;
    b[i] = pair.b;
  }

  print(a); // [A, B, C, E]
  print(b); // [1, 2, 3, 5]
}