diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart index dc404c6948..d045c83f04 100644 --- a/dev/devicelab/lib/framework/runner.dart +++ b/dev/devicelab/lib/framework/runner.dart @@ -157,4 +157,9 @@ Future cleanupSystem() async { } else { print('Could not determine JAVA_HOME; not shutting down Gradle.'); } + // Removes the .gradle directory because sometimes gradle fails in downloading + // a new version and leaves a corrupted zip archive, which could cause the + // next devicelab task to fail. + // https://github.com/flutter/flutter/issues/65277 + rmTree(dir('${Platform.environment['HOME']}/.gradle')); }