I get lot of errors when running command flutter run --release.
xxx#xxx-Inspiron-14-3467:~/Desktop/xxx$ flutter run --release
Multiple devices found:
SM A207F (mobile) • R9WMA0D0G7J • android-arm64 • Android 10 (API 29)
Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
[0]: SM A207F (R9WMA0D0G7J)
[1]: Android SDK built for x86 (emulator-5554)
Please choose one: [0|1]: 0
Launching lib/main.dart on SM A207F in release mode...
Running Gradle task 'assembleRelease'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/xxx/Desktop/flutter_linux_1.20.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.2/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':connectivity:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/home/xxx/.gradle/caches/transforms-2/files-2.1/56399ec8cdc895aa561f5aa75e965d03/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/home/xxx/.gradle/caches/transforms-2/files-2.1/56399ec8cdc895aa561f5aa75e965d03/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
* 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 22s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 202.7s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin connectivity...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 2.0s
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'connectivity'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 1s
Exception: The plugin connectivity could not be built due to the issue above.
flutter doctor -v
xxx#xxx:~/Desktop/xxx$ flutter doctor -v
[✓] Flutter (Channel stable, 1.20.2, on Linux, locale en_US.UTF-8)
• Flutter version 1.20.2 at /home/xxx/Desktop/flutter_linux_1.20.2-stable/flutter
• Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09 -0700
• Engine revision 9d5b21729f
• Dart version 2.9.1
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /home/xxx/Android/Sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Android Studio (version 3.5)
• Android Studio at /opt/android-studio
• Flutter plugin version 41.0.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.37.1)
• VS Code at /usr/share/code
• Flutter extension version 3.4.1
[✓] Connected device (2 available)
• SM A207F (mobile) • R9WMA0D0G7J • android-arm64 • Android 10 (API 29)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
• No issues found!
What went wrong: A problem occurred configuring root project 'connectivity'.
The issue is came from connectivity plugin. After I upgraded to the latest version, it able to run now.
Related
My flutter app when run from VScode is always stuck at running-gradle-task-assembledebug
When I run flutter run -v in command prompt, it works but not from VSCode. This issue seems to have come since last week.
Tried ./gradlew clean and ./gradlew clean build, this works sometimes and buils from vscode
Deleted and created a new emulator device and also tried many suggestions online
Output from flutter doctor -v
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19044.1415], locale en-US)
• Flutter version 2.8.1 at E:\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 30.0.2)
• Android SDK at E:\sdk\Android
• Platform android-31, build-tools 30.0.2
• ANDROID_SDK_ROOT = E:\sdk\Android
• Java binary at: F:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at F:\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.10+0-b96-7249189)
[√] Connected device (3 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.62
• No issues found!
created a brand new flutter project and did gradlew clean and got below messages for gradlew clean --warning-mode all
> Configure project :app
Adding a Configuration as a dependency is a confusing behavior which isn't recommended. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. If you're interested in inheriting the dependencies from the Configuration you are adding, you should use Configuration#extendsFrom instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:extendsFrom(org.gradle.api.artifacts.Configuration[]) for more details.
at build_59yj46qtreisbbowxqfuhj29p$_run_closure3.doCall(D:\MobileDevelopment\GitRepo\jigsaw\android\build.gradle:26)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
at FlutterPlugin$_addFlutterTasks_closure20$_closure44.doCall(E:\Flutter\packages\flutter_tools\gradle\flutter.gradle:833)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
at FlutterPlugin$_addFlutterTasks_closure20$_closure44.doCall(E:\Flutter\packages\flutter_tools\gradle\flutter.gradle:834)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 up-to-date
Running gradlew build gives
> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libflutter.so.
> Task :app:stripProfileDebugSymbols
Unable to strip the following libraries, packaging them as they are: libapp.so, libflutter.so, libvmservice_snapshot.so
> Task :app:lint FAILED
Ran lint on variant debug: 3 issues found
Ran lint on variant release: 3 issues found
Ran lint on variant profile: 3 issues found
Wrote HTML report to file:///D:/MobileDevelopment/GitRepo/jigsaw/build/app/reports/lint-results.html
Wrote XML report to file:///D:/MobileDevelopment/GitRepo/jigsaw/build/app/reports/lint-results.xml
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
Errors found:
D:\MobileDevelopment\GitRepo\jigsaw\android\app\src\main\AndroidManifest.xml:5: Error: Class referenced in the manifest, com.example.jigsaw.${applicationName}, was not found in the project or the libraries [MissingClass]
android:name="${applicationName}"
~~~~~~~~~~~~~~~~~~
* 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
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
BUILD FAILED in 2m 26s
94 actionable tasks: 90 executed, 4 up-to-date
Redownloaded flutter 2.8 sdk from google official docs which also has dart in it and retried.
It's due to your gradle is downloading it's version but sometimes it's speed download too low and won't be downloaded, you can fix it :
first check your gradle version in root of your project :
<project name> > android > gradle > wrapper > gradle-wrapper.properties
and check distributionUrl , you will see which gradle version is using in project and is downloading , so you should download that version in this link https://services.gradle.org/distributions/
after you download, copy and go to this directory :
C:\Users\<user name>\.gradle\wrapper\dists\gradle <your version>\<a file with weird name>\
paste and unzip your downloaded file here.
it works for me every time I hope for you too.
let me know if there is any question.
I did solve the problem by first executing
flutter clean
and then, in order to recompile the project daet files
flutter pub upgrade
Improperly formatted define flag: memory
FAILURE: Build failed with an exception.
Where: Script 'C:\newfluttersdk\flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 896
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\newfluttersdk\flutter\bin\flutter.bat'' 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 2s Running Gradle task 'assembleDebug'... Running
Gradle task 'assembleDebug'... Done 3.3s
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor -v
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version
10.0.18362.657], locale en-IN)
• Flutter version 1.20.1 at C:\newfluttersdk\flutter
• Framework revision 2ae34518b8 (5 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.3)
• Android SDK at C:\Users\DeepikaRavi\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code, 64-bit edition (version 1.45.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.11.0
[√] Connected device (1 available)
• vivo Y51L (mobile) • 34d9bc20 • android-arm64 • Android 5.0.2 (API 21)
• No issues found!
Thanks in Advance.
#deepika can you please try this commands
flutter upgrade --force
flutter pub cache repair
cd <YOUR APP FOLDER>
flutter clean```
You should upgrade version android.
like that
android/build.gradle
classpath 'com.android.tools.build:gradle:4.1.1'
android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
delete you yamillock file and run get pub it solve the issue for me
I created a new flutter project and when run it, it gives that error
Target kernel_snapshot failed: Exception: The value of -DDartDefines is not formatted correctly.
The value must be a JSON-encoded list of strings but was:
[flutter.inspector.structuredErrors=true]
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' 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
Exception: Gradle task assembleDebug failed with exit code 1
I have tried flutter clean, and same error
flutter doctor log :
D:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel master, v1.16.4-pre.69, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
• Flutter version 1.16.4-pre.69 at D:\flutter
• Framework revision 19e7db585d (4 months ago), 2020-04-01 11:16:01 -0700
• Engine revision c9506cb8e9
• Dart version 2.8.0 (build 2.8.0-dev.18.0 eea9717938)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code (version 1.47.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Process finished with exit code 0
According to what flutter doctor is giving you the problem might be related to Android Sdk not installed or not configured really well:
Flutter provides a command to update the Android SDK path: Use
flutter config --android-sdk <path-to-your-android-sdk-path>
You can install it directly from Android Studio:
To open the SDK Manager from Android Studio, click Tools > SDK Manager or click SDK Manager in the toolbar. You might have to uncheck "hide obsolete packages" and install the packages that were considered obsoletes.
Or you can install it from this link and configure it like I said before:
https://www.google.com/url?sa=t&source=web&rct=j&url=https://android-sdk.fr.uptodown.com/windows&ved=2ahUKEwi-itWCkuzqAhXTZTUKHa29CRMQFjACegQIAhAB&usg=AOvVaw1QSSVVMrZzFltXvboDbTeQ
Everytime i try to build an apk or appbundle, this error comes up. please help.
Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is currently executing will be u
sed instead.
running Flutter tool: C:\Users\MOMO\Mygit\flutter
previous reference : C:\flutter
This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your pat
h).
Compiler message:
/C:/flutter/packages/flutter/lib/src/rendering/layer.dart:1580:36: Error: 'ImageFilterEngineLayer' isn't a type.
oldLayer: _engineLayer as ui.ImageFilterEngineLayer,
^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/rendering/layer.dart:1578:27: Error: The method 'pushImageFilter' isn't defined for the class 'SceneBuilder'.
'SceneBuilder' is from 'dart:ui'.
Try correcting the name to the name of an existing method, or defining a method named 'pushImageFilter'.
engineLayer = builder.pushImageFilter(
^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\MOMO\Mygit\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\Users\MOMO\Mygit\flutter\bin\flutter.bat'' 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 14s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 15.7s
Gradle task assembleRelease failed with exit code 1
Thats my flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.778], locale en-US)
• Flutter version 1.12.13+hotfix.9 at C:\Users\MOMO\Mygit\flutter
• Framework revision f139b11 (4 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\MOMO\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at D:\Android\Android Studio1
• Flutter plugin version 45.0.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.1
• Flutter plugin version 45.0.2
• Dart plugin version 193.5731
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Running my first Flutter program, encountered this issue. Unable to resolve it by adding Google().
Error Message
*Error running Gradle:
ProcessException: Process "C:\Users\hariharan\Desktop\helloflutter\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
*Where:
Build file 'C:\Users\hariharan\Desktop\helloflutter\android\build.gradle' line: 24
*What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to find target with hash string 'android-28' in: C:\Users\hariharan\AppData\Local\Android\sdk
*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 15s
Command: C:\Users\hariharan\Desktop\helloflutter\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Running flutter doctor -v
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17134.829], locale en-SG)
• Flutter version 1.5.4-hotfix.2 at C:\flutter_windows_v1.5.4-hotfix.2-stable\flutter
• Framework revision 7a4c33425d (8 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at C:\Users\hariharan\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• ANDROID_HOME = C:\Users\hariharan\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.35.1)
• VS Code at C:\Users\hariharan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.1.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
No issues found!
From the error: Failed to find target with hash string 'android-28', it seems that it's unable to find build tools for version 28. If you're using Android Studio, you can go through Tools > SDK Manager > Android SDK and make sure that you've got your Android SDKs up-to-date.