Updated 2022-05-22 0
Viewed 60 times
0

Hello while trying to run my App on Android device im getting following error

Launching lib/main.dart on SM T500 in debug mode...
lib/main.dart:1
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/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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
e: /Users/yavuzatmaca/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-4.1.1/android/src/main/kotlin/com/example/appsettings/AppSettingsPlugin.kt: (44, 25): Type mismatch: inferred type is Activity? but Activity was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app_settings:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 20s
Exception: Gradle task assembleDebug failed with exit code 1
Exited

I run this command

./gradlew clean assembleDebug

to get more information This is the output

> Task :app:processDebugMainManifest FAILED

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 @6c21d774

* 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.

I googled the error and everyone says I need to use another idk version than 16. So I did I tried 11 and 15 .I m able to change the version on my Mac to 15 But when running flutter doctor -v its giving me this

 Android Studio (version 2021.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 11.0.12+0-b1504.28-7817840)

Please help me I fucking spend 5 hours without a solution.

🔴 No definitive solution yet