Build failed on nfc_in_flutter after upgrade - android

After Flutter upgrade, I can't build app.
../../../flutter/.pub-cache/hosted/pub.dartlang.org/nfc_in_flutter-2.0.5/lib/src/api.dart:524:54: Error: The operator '[]' isn't defined for the class 'Object'.
'Object' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '[]' operator.
throw NFCTagSizeTooSmallException(e.details["maxSize"] ?? 0);
^
FAILURE: Build failed with an exception.
Where:
Script '/Users/sissa/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '../../flutter/bin/flutter'' finished with non-zero exit value 1
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 41s
Exception: Gradle task assembleDebug failed with exit code 1
This is my Flutter doctor output:
[✓] Flutter (Channel master, 1.27.0-5.0.pre.18, on macOS 11.1 20C69 darwin-x64, locale en-GB)
• Flutter version 1.27.0-5.0.pre.18 at /Users/sissa/flutter
• Framework revision 50897c98fc (6 days ago), 2021-02-16 20:13:53 -0800
• Engine revision 9bcb3bfb0e
• Dart version 2.13.0 (build 2.13.0-30.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/sissa/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/sissa/Library/Android/sdk
• Java binary at: /Applications/Android Studio 2.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• 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 1.8.0_202-release-1483-b49-5587405)
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio 2.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 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.40.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)
• SM J610FN (mobile) • bbc7a841 • android-arm • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.182
• No issues found!
Actions done that didn't work:
flutter clean
Invalidate caches / restart

Upgrading to 1.27.0-4.0.pre dev channel solve the problem. Thanks to #Akif suggestion.

Related

Flutter android bug on using tensorflow package tflite_flutter

I'm trying to use tensorflow lite packages from new flutter project connecting my samsung phone. I have only modified in android/app/build.gradle file
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31
and in pubspec.yaml
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
image: ^3.1.0
tflite_flutter: ^0.9.0
tflite_flutter_helper: ^0.3.1
path_provider: ^2.0.8
However, I get following errors. Anyone can help me resolving thos errors? what should I do?
Launching lib/main.dart on SM N981N in debug mode...
Running Gradle task 'assembleDebug'...
e: /Users/sangyoonhan/flutter/.pub-cache/hosted/pub.dartlang.org/tflite_flutter_helper-0.3.1/android/src/main/kotlin/com/tfliteflutter/tflite_flutter_helper/TfliteFlutterHelperPlugin.kt: (43, 1): Class 'TfliteFlutterHelperPlugin' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: /Users/sangyoonhan/flutter/.pub-cache/hosted/pub.dartlang.org/tflite_flutter_helper-0.3.1/android/src/main/kotlin/com/tfliteflutter/tflite_flutter_helper/TfliteFlutterHelperPlugin.kt: (143, 2): 'onRequestPermissionsResult' overrides nothing
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tflite_flutter_helper: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 2s
I will leave flutter doctor information. I got no clue why these errors are occuring
(base) sangyoonhan#Sangyoonui-MacBookPro untitled % flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-x64, locale ko-KR)
• Flutter version 3.3.8 on channel stable at /Users/sangyoonhan/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (8주 전), 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 31.0.0)
• Android SDK at /Users/sangyoonhan/Library/Android/sdk
• Platform android-33, 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.12+0-b1504.28-7817840)
• 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 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)
[✓] VS Code (version 1.74.1)
• VS Code at /Users/sangyoonhan/Downloads/학교/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (4 available)
• SM N981N (mobile) • R3CR10GC91P • android-arm64 • Android 12 (API 31)
• iPhone 14 Pro Max (mobile) • 6D97D66D-63AB-4822-9EF5-D0C7DA86B6D4 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.124
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Somebody help me!

Flutter 3.0.2: Execution failed for task ':app:compileDebugKotlin'

I'm upgrading Flutter to 3.0.2 and android has this issue when running on the emulator.
I'm searching for the same issue and updating kotlin_version to lastest but it's not working.
I'm also clean and pub get but still not working.
anyone has a solution.
ext.kotlin_version = '1.5.10'
Flutter doctor:
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale en-VN)
• Flutter version 3.0.2 at /Users/anhdinhhoangquang/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cd41fdd495 (2 weeks ago), 2022-06-08 09:52:13 -0700
• Engine revision f15f824b57
• Dart version 2.17.3
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/anhdinhhoangquang/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] 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)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• 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.65.2)
• VS Code at /Users/anhdinhhoangquang/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[✓] Connected device (5 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 32) (emulator)
• iPad của Kha (mobile) • 647828f7a35c6397e6a75001cf0ef213d0fbdee1 • ios • iOS 12.2 16E227
• iPhone 13 Pro (mobile) • F7F65BF2-C9A8-4D8C-8DB7-A0D6AAE3F811 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4
(simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app: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

FAILURE: Build failed with an exception Flutter project

Facing this issue while running on android
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/Volumes/Macintosh Data/flutter_app/android/settings.gradle' (/Users/myimac/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
* 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
Exception: Gradle task assembleDebug failed with exit code 1
My environment
[✓] Flutter (Channel stable, 2.10.3, on Mac OS X 10.15.7 19H1715 darwin-x64,
locale en-US)
• Flutter version 2.10.3 at /Users/myimac/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (4 days ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /Users/myimac/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at:
/Library/Java/JavaVirtualMachines/jdk1.8.0_321.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• 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.11+0-b60-7590822)
[✓] Connected device (3 available)
• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 11
(API 30) (emulator)
• macOS (desktop) • macos • darwin-x64 • Mac OS X
10.15.7 19H1715 darwin-x64
• Chrome (web) • chrome • web-javascript • Google
Chrome 99.0.4844.51
[✓] HTTP Host Availability
• All required HTTP hosts are available

Flutter Execution failed for task ':app:processDebugResources'. Could not resolve all dependencies for configuration ':app:debugCompileClasspath'

Flutter project stopped building today all of a sudden.
Here's the full error:
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
> Problems reading data from Binary store in /private/var/folders/_5/q7ql37gj5k7f37d865zhzl8c0000gn/T/gradle18017070233811730283.bin offset 35036 exists? true
* 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 28s
Running Gradle task 'assembleDebug'... 29.7s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried:
flutter clean, deleted pubspec.lock and flutter pub cache repair to get rid of cache and reinstall packages but nothing.
flutter downgrade, got the same error.
Fresh reinstall of flutter, same thing.
Fresh git clone of the project, nothing.
Any hints?
Here's my flutter doctor -v:
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
en-GB)
• Flutter version 2.8.1 at /Users/gracielacarrillo/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version
31.0.0)
• Android SDK at /Users/gracielacarrillo/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 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• 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.63.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.32.0
[✓] Connected device (2 available)
• sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11
(API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 97.0.4692.71
• No issues found!
Maybe you are getting errors because of jcenter. Follow the link and switch to mavenCenteral.
Switch to Maven Central

Cannot run flutter application on first run, gradle error

I have created a new flutter app and I cannot get it to run for the first time. It gets stuck at running Gradle task assembleDebug. This is the error message I get
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> NDK at C:\Users\Hp\AppData\Local\Android\sdk\ndk-bundle did not have a source.properties file
* 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 3m 10s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have ran flutter doctor and this are the results
[√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19041.804], locale en-US)
• Flutter version 2.0.0 at C:\dev\flutter
• Framework revision 60bd88df91 (2 days ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Hp\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• 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 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.54.1)
• VS Code at C:\Users\Hp\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (3 available)
• Redmi 6 (mobile) • a28707477d26 • android-arm • Android 9 (API 28)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
Base from the error, the NDK build in your machine can't be used. One way to resolve this issue is by deleting the current NDK and have Flutter download a new NDK build. Head over to the NDK path provided in the error and delete ndk-bundle folder, then run flutter clean in the terminal. Running the app again should automatically run flutter pub get to rebuild all the references and dependencies.

Categories

Resources