open_weather_example_flutter icon indicating copy to clipboard operation
open_weather_example_flutter copied to clipboard

Build issue in Android Studio

Open ukaeufe opened this issue 2 years ago • 2 comments

Hi,

I get a build error in Android Studio for this project (see bold issue) below.

I assume there is an inconsistency of java or kotlind version with what you need?

Launching lib/main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'... Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level> Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

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 @8549e3c**

  • 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 29s Exception: Gradle task assembleDebug failed with exit code 1

Here the output of flutter doctor

[uka@MacBook prj]$flutter doctor -v [!] Flutter (Channel stable, 3.10.5, on macOS 12.6.6 21G646 darwin-x64, locale en-DE) • Flutter version 3.10.5 on channel stable at /users/uka/flutter ! Warning: flutter on your path resolves to /Users/uka/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /users/uka/flutter. Consider adding /users/uka/flutter/bin to the front of your path. ! Warning: dart on your path resolves to /Users/uka/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /users/uka/flutter. Consider adding /users/uka/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (7 weeks ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/uka/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.73.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.6.6 21G646 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources • All expected network resources are available.

! Doctor found issues in 1 category.

ukaeufe avatar Jul 29 '23 13:07 ukaeufe

To solve the issue update the android\build.gradle file. Change current version of Gradle and Kotlin. For example: ext.kotlin_version = '1.9.0',
classpath 'com.android.tools.build:gradle:7.1.2'.

ionLuca23 avatar Sep 07 '23 12:09 ionLuca23

@ionLuca23 thank you for the suggestion, could you open a PR for this?

bizz84 avatar Sep 07 '23 17:09 bizz84