What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
i did update my packages in pubspec to upgradable version , more than one post that im trying to run my project and this is the error im getting
im unable to locate the duplicated class or file. its not a cache issue coz i cleaned it many times.
i also got this recommendation along with error:-
Go to the documentation to learn how to Fix dependency resolution errors.
i tried to update the package in pubspec yaml and was trying to run the app
here are some basic info about my project
[√] Flutter (Channel stable, 3.3.6, on Microsoft Windows [Version 10.0.19045.2486], locale en-IN)
• Flutter version 3.3.6 on channel stable at C:\fluttersdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 6928314d50 (4 months ago), 2022-10-25 16:34:41 -0400
• Engine revision 3ad69d7be3
• Dart version 2.18.2
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\agile\AppData\Local\Android\sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: C:\Program Files\Java\jdk-11.0.16\bin\java
• Java version Java(TM) SE Runtime Environment 18.9 (build 11.0.16+11-LTS-199)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.19)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.32901.82
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] IntelliJ IDEA Community Edition (version 2022.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.2
• 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
[√] VS Code (version 1.75.1)
• VS Code at C:\Users\agile\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.58.0
[√] Connected device (4 available)
• RMX1911 (mobile) • e5c025a0 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.2486]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.78
[√] HTTP Host Availability
• All required HTTP hosts are available
Related
I tried to run my project from laptop, and have ancounted to problem.
What went wrong:
A problem occurred configuring root project 'android'.
Could not load compiled classes for build file 'C:\programming\projects\flutter\android\build.gradle' from cache.
I also use firebase and library flutter_background_geolocation 4.8.3
Flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19044.2251], locale ru-RU)
• Flutter version 3.3.8 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (2 days ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio1
• 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.13+0-b1751.21-8125866)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.52.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2251]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107
• Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.35
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
i show only error message.
What i can do to fix this problem ?
I already tried to flutter clean, flutter pub cache repair, restart laptop, reinstall android studio, and reinstall android emulator.
I tried using the solutions online but nothing worked.
Deleted android folder and ran 'flutter create .'
Ran 'gradlew clean build' but the build was failed
* What went wrong:
Could not compile build file 'C:\Users\EVO.store\StudioProjects\playground2point0\android\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 62
Updated my JAVA_HOME variable to 'C:\Program Files\Java\jdk-18'
I honestly have no idea what to do anymore, the main.dart file works just fine. But I'd like to edit a few things for the android version.
What exactly am I missing here?
Here's what it looks like:
https://imgur.com/a/bQ4mNXx
Here's my Flutter doctor output:
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.22000.556], locale en-US)
• Flutter version 2.10.4 at C:\Users\EVO.store\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\EVO.store\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Users\EVO.store\AppData\Local\Google\Chrome\Application\chrome.exe
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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.11+9-b60-7590822)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\EVO.store\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.556]
• Chrome (web) • chrome • web-javascript • Google Chrome 71.0.3578.98
• Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.39
[√] HTTP Host Availability
• All required HTTP hosts are available
I using Macbook Air M1. Simple flutter project. Trying to build the app for android device or emulator no mattaer through Android Studio or from terminal flutter return this message:
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Exception: The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
Trying chmod 777 for both projet and sdk folders did nothing.
Flutter docor output:
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
en-IL)
• Flutter version 2.5.3 at /Users/michaelbabozhko/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/michaelbabozhko/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• 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.10+0-b96-7249189)
[✓] VS Code (version 1.61.0)
• 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 (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12
(API 31) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 94.0.4606.81
• No issues found!
I had same issue on M1 MacBook with Flutter version v2.5.3 and I tried that way and it worked.
Open your project's android folder with Android Studio
Wait for Android Studio when it installs missing plugins and syncs Gradle.
Open your project on VSCode, debug and have fun!
Answered!
Finally I found solution - just reseted android stiudio settings to defaults and downloaded plugins. See screenshot attachedenter image description here.
I have developed a flutter app that runs well in Chrome (Web-based) but when I try to run on Android phone it gives me the following error:
* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
Will be grateful if someone can send me solution.
D:\flutterapps\etea>flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1165], locale en-GB)
• Flutter version 2.2.3 at c:\flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Lenovo\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Justinmind\Justinmind 9.2.0\app\jdk\9.2.0\bin\java
• Java version OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• 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
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] Connected device (3 available)
• SM A205F (mobile) • R58M739343L • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
• Edge (web) • edge • web-javascript • Microsoft Edge 92.0.902.78
! Doctor found issues in 2 categories.
I met a problem where when I build the application, it shows there is error where the package is not exists. I am using the example code that provided at pub dev of the dependency flutter_secure_storage. I have already change the minSdkVersion to 18.
Can I know is there any ways to fix this problem?
android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:16: error: package com.it_nomads.fluttersecurestorage does not exist
flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());
^
1 error
My flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.18363.1440], locale en-MY)
• Flutter version 2.2.1 at C:\Users\nurfa\flutter
• Framework revision 02c026b03c (6 days ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\nurfa\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\ProgramData\Oracle\Java\javapath\java.exe
• Java version Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1
• 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
[√] VS Code (version 1.56.2)
• VS Code at C:\Users\nurfa\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (3 available)
• COR L29 (mobile) • XTX7N18B29009354 • android-arm64 • Android 9 (API 28)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.51
after some search through Google, I have found a solution for my issue through Github. It could be some problem in the pub-cache folder. I follow the comment from one post in Github and deleted flutter_secure_storage inside the pub-cache folder and reinstall and it won't show the error anymore.
https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/127#issuecomment-522273569