Upgrading android studio broke my flutter build (macOS)

Viewed 640

Ive just upgraded my android studio and its broken my flutter build process. I now get this error trying to build previously working projects. My andriod studio setup at the end. Appreciate any help with this.

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @4be5c282

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

detailed:

FAILURE: Build failed with an exception.
What went wrong:
 Execution failed for task ':app:processDebugMainManifest'.
[> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not
"opens java.io" to unnamed module @4be5c282
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 4s
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 20 actionable tasks: 4 executed, 16 up-to-date
[ +498 ms] Running Gradle task 'assembleDebug'... (completed in 5.0s)
[+1124 ms] Exception: Gradle task assembleDebug failed with exit code 1
[  +14 ms] "flutter run" took 7,187ms.
[  +15 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:663:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>

Android Studio Arctic Fox | 2020.3.1 Patch 1 Build #AI-203.7717.56.2031.7621141, built on August 7, 2021 Runtime version: 11.0.10+0-b96-7281165 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.5.1 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 8 Registry: external.system.auto.import.disabled=true Non-Bundled Plugins: org.jetbrains.kotlin

2 Answers

I was able to resolve mine after updating Android SDK Tools and NDK under SDK Tools.

I had the same problem and solved installing a JDK.

Went to Project Structure -> Platform Settings -> SDKs, selected a Platform, then Java SDK, and downloaded the latest (you can download the one you are supposed to use in your project).

Related