Gradle分析构建不适用于Android

cgh8pdjw  于 2023-04-28  发布在  Android
关注(0)|答案(1)|浏览(90)

我正尝试按照以下文档中的说明来分析我的构建:
https://developer.android.com/studio/build/optimize-your-build#profile
我试着像下面这样运行它

./gradlew --profile --offline --rerun-tasks assembleBetaDebug

出现以下错误:

* What went wrong:
Could not write to file 'reports/profile/profile-2020-04-08-11-53-41.html'.
> Unable to create directory 'reports/profile'

stacktrace:

org.gradle.api.UncheckedIOException: Could not write to file 'reports/profile/profile-2020-04-08-11-53-41.html'.
    at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(IoActions.java:152)
    at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(IoActions.java:127)
    at org.gradle.internal.IoActions.writeTextFile(IoActions.java:45)
    at org.gradle.reporting.HtmlReportRenderer$DefaultHtmlReportContext.renderHtmlPage(HtmlReportRenderer.java:120)
    at org.gradle.reporting.HtmlReportRenderer$1.render(HtmlReportRenderer.java:61)
    at org.gradle.reporting.HtmlReportRenderer$1.render(HtmlReportRenderer.java:58)
    at org.gradle.reporting.HtmlReportRenderer.render(HtmlReportRenderer.java:42)
    at org.gradle.reporting.HtmlReportRenderer.renderSinglePage(HtmlReportRenderer.java:58)
    at org.gradle.profile.ProfileReportRenderer.writeTo(ProfileReportRenderer.java:32)
    at org.gradle.profile.ReportGeneratingProfileListener.buildFinished(ReportGeneratingProfileListener.java:50)
    at jdk.internal.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:382)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:364)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:352)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.dispatch(DefaultListenerManager.java:163)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.dispatch(DefaultListenerManager.java:137)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy5.buildFinished(Unknown Source)
    at org.gradle.profile.ProfileEventAdapter.completed(ProfileEventAdapter.java:86)
    at jdk.internal.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:382)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:364)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:352)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.dispatch(DefaultListenerManager.java:163)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.dispatch(DefaultListenerManager.java:137)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy17.completed(Unknown Source)
    at org.gradle.initialization.DefaultGradleLauncher.stop(DefaultGradleLauncher.java:260)
    at org.gradle.composite.internal.DefaultRootBuildState.stop(DefaultRootBuildState.java:69)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.stop(DefaultServiceRegistry.java:583)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.stop(DefaultServiceRegistry.java:470)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$CompositeServiceProvider.stop(DefaultServiceRegistry.java:962)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry.close(DefaultServiceRegistry.java:259)
    at org.gradle.internal.concurrent.CompositeStoppable$2.stop(CompositeStoppable.java:90)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.initialization.DefaultGradleLauncher.stop(DefaultGradleLauncher.java:258)
    at org.gradle.composite.internal.DefaultRootBuildState.stop(DefaultRootBuildState.java:69)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.composite.internal.DefaultIncludedBuildRegistry.stop(DefaultIncludedBuildRegistry.java:256)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.stop(DefaultServiceRegistry.java:583)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.stop(DefaultServiceRegistry.java:583)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.stop(DefaultServiceRegistry.java:470)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry$CompositeServiceProvider.stop(DefaultServiceRegistry.java:962)
    at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:106)
    at org.gradle.internal.service.DefaultServiceRegistry.close(DefaultServiceRegistry.java:259)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:44)
    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:68)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:27)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
    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:63)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.io.IOException: Unable to create directory 'reports/profile'
    at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(IoActions.java:142)
    ... 105 more
  • 我试过Invaliate Caches / Restart,但不适合我。
  • 我尝试在gradle.properties文件中添加android.enableAapt2=false行,但它对我不起作用。

有什么想法吗

9fkzdhlc

9fkzdhlc1#

您是否在“www.example.com“上启用了配置缓存gradle.properties?

org.gradle.unsafe.configuration-cache=true

如果您删除该选项,然后尝试相同的配置文件命令,它会工作。
https://github.com/gradle/gradle/issues/18386
对我来说,我能够看到报告,但报告构建时间是不准确的。配置文件总构建时间是由利润,因为它设置的开始时间为“开始于:1969/12/31 - 16:00:00”

相关问题